就在1周前,我一直在为一个项目在VueJS上工作。
我创建了两个组件: * 帐户.vue (父级)
<!--It's just a little part of the code-->
<e-textarea
title="Informations complémentaires"
@input="otherInformation" <!--otherInformation is a string variable which contains the text value-->
:value="otherInformation"></e-textarea>
TextArea.vue (子组件)
<template>
<div class="form-group">
<label for="e-textarea">{{ title }}</label>
<textarea
id="e-textarea"
class="form-control"
row="3"
:value="value"
v-on="listeners"
>
</textarea>
</div>
</template>
<script>
import { FormGroupInput } from "@/components/NowUiKit";
export default {
name: "e-textarea",
components: {
[FormGroupInput.name]: FormGroupInput
},
props: {
title: String,
value: String
},
computed: {
listeners() {
return {
...this.$listeners,
input: this.updateValue
};
}
},
methods: {
updateValue(value) {
this.$emit("input", value);
}
},
mounted() {
console.log(this.components);
}
};
</script>
<style src="@/assets/styles/css/input.css" />
当我从我的 Account.vue 在文本区域自定义组件中编写某些内容时,我的文本值不会更新,并且我的侦听器函数也不会传递。我需要有别的东西吗?
梵蒂冈之花
30秒到达战场
相关分类