有啥問題嗎 為什么一直沒反應
<!--組件的拆分
? ? 1. 定義并使用一個全局組件(任意地方都可以使用)-->
? ? ? ? <div id="root">
? ? ? ? ? ? <input type="text" v-model="inputValue">
? ? ? ? ? ? <button @click="handleSubmit">提交</button>
? ? ? ? ? ? <ul>
? ? ? ? ? ? ? ? <todo-item v-for="(item,index) of list" :key="index" :content="item"></todo-item>
? ? ? ? ? ? </ul>
? ? ? ? </div>
? ? ? ? <script>
? ? ? ? ? ? Vue.component("todo-item",{
? ? ? ? ? ? ? ? props:['content'],? ? ?//傳值 Vue 中,父組件到子組件的傳值,是通過屬性進行傳遞的。
? ? ? ? ? ? ? ? template:"<li>{{content}}</li>" //模板
? ? ? ? ? ? })
? ? ? ? ? ? new Vue({
? ? ? ? ? ? ? ? el:"#root",
? ? ? ? ? ? ? ? data:{
? ? ? ? ? ? ? ? ? ? inputValue="",??
? ? ? ? ? ? ? ? ? ? list:[]
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? methods:{
? ? ? ? ? ? ? ? ? ? handleSubmit:function() {
? ? ? ? ? ? ? ? ? ? ? ? this.list.push(this.inputValue),
? ? ? ? ? ? ? ? ? ? ? ? this.inputValue=""
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? })
? ? ? ? </script>
? ??
? ??
</body>
</html>
2018-11-03
?data:{
? ? ? ? ? ? ? ? ? ? inputValue="",??
? ? ? ? ? ? ? ? ? ? list:[]
? ? ? ? ? ? ? ? },
?里面的 = 號應該改成 :? 是鍵值對的形式 其他地方?jīng)]問題
2018-10-31
沒有啥反應????能不能描述詳細一些。。另外先問問 你有沒有引入vue文件