Vue中你忽略的点

自定义组件使用 v-model

<my-component v-model="data"></my-component>

在组件my-component中,通过this.$emit(‘input’)就可以改变data的值了。

this._uid

<div :id="eleId"></div>
<script>
computed: {
	eleId () {
		return `count_${this._uid}`
	}
}
</script>

每一个vue实例属性中都有一个this._uid, 每个组件中的this._uid值都不相同, 唯一的

posted @ 2019-05-17 14:20  仲灏  阅读(124)  评论(0编辑  收藏  举报