v-model 绑定值编译失败

来源:4-4 单页面应用 Demo2(1)

Lyl123

2019-02-22 11:03

<template>
    <div>
        <p>标题</p>
        <input v-model="title">
        <p>内容</p>
        <!--<input v-model="content">-->
        <button @click="add()">提交</button>
    </div>
</template>

<script>
    import store from '@/store'

    export default {
        name: "Add",
        store,
        data() {
            return {
                title: '1',
                content: '1',
            }
        },
        methods: {
            add() {
                store.commit('add', {title: this.title, content: this.content})
                this.title = ''
                this.content = ''
            }
        }
    }
</script>

<style scoped>

</style>


写回答 关注

1回答

3小时速成 Vue2.x 核心技术

带你快速学习最流行的前端框架vue2.x的核心技术

82559 学习 · 487 问题

查看课程

相似问题