父组件

<template>
  <div >
    <h-input v-model="name" />
  </div>
</template>

<script>
import hInput from "./views/demo/index";

export default {
  name: "App",
  data() {
    return {
      name: "",
    };
  },
  components: {
    hInput,
  },
  watch: {
    name(val) {
      console.log(val);
    },
  },
};
</script>

子组件

<template>
  <div>
    <el-input :value="value" @input="inputChange($event)"></el-input>
  </div>
</template>

<script>
export default {
  props: {
    value: String,
  },
  components: {},
  data() {
    return {};
  },
  methods: {
    inputChange(val) {
      this.$emit("input", val);
    },
  },
};
</script>

相关文章:

  • 2021-08-27
  • 2021-08-27
  • 2021-08-27
  • 2021-08-27
  • 2021-08-27
  • 2018-03-08
  • 2021-10-30
  • 2022-12-23
猜你喜欢
  • 2021-08-27
  • 2021-08-27
  • 2023-03-31
  • 2021-08-27
  • 2022-12-23
  • 2021-08-09
相关资源
相似解决方案