- "username" @input="username = $event.target.value" />
- "username" />
- <script>
- export default {
- props: {
- value: {
- required: true,
- },
- },
- watch: {
- value(newValue) {
- this.my_input = newValue;
- },
- },
- data() {
- return {
- my_input: this.value,
- };
- },
- methods: {
- handleChange() {
- this.$emit("input", this.my_input);
- },
- },
- };
- script>
- <template>
- <el-input v-model="my_input" @change="handleChange">el-input>
- template>
-
- <my-component v-model="username" />