weixin_慕后端445827
2020-05-12 16:44
<script> import {mapMutations} from 'vuex' export default { name: 'Add', data () { return { title: '', content: '' } }, methods: { ...mapMutations(["addItem"]), add () { this.addItem({ title: this.title, content: this.content }); } } } </script>
store.js
export default new Vuex.Store({ state: { lists: [] }, mutations: { addItem (state, value) { this.state.lists.push(value) } }, actions: { }, modules: { } })
数据没有双向绑定
3小时速成 Vue2.x 核心技术
82578 学习 · 489 问题
相似问题