按照老師的代碼下來我運行不出來結(jié)果呀
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="UTF-8">
? ? <title>vue_test</title>
? ? <script src="vue.js"></script>
</head>
<body>
? ? <div id="root">
? ? ? ? <input v-model="inputValue"/>
? ? ? ? <button @click="handleSubmit">提交</button>
? ? </div>
? ? <ul>
? ? ? ? <li v-for="(item,index) of list" :key="index">{{item}}</li>
? ? </ul>
<script>
? ? new Vue({
? ? ? ? el:"#root",
? ? ? ? data:{
? ? ? ? ? ? inputValue: '',
? ? ? ? ? ? list:[]
? ? ? ? },
? ? ? ? methods:{
? ? ? ? ? ? handleSubmit:function () {
? ? ? ? ? ? ? ? this.list.push(this.inputValue)
? ? ? ? ? ? }
? ? ? ? }
? ? })
</script>
</body>
</html>
2019-02-27
你的模板沒有放在掛載點那里
2020-04-15
掛載點 div標(biāo)簽沒有把ul li包進(jìn)去