拆分组件总是提示vue is not defined 为什么 没找到原因

来源:3-2 todolist组件拆分

NoError2018

2018-09-18 14:54

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="root">
    <div>
        <input v-model="inputValue">
        <button @click="handleSubmit">提交</button>
    </div>

    <ul>
 <!--<li v-for="(item,index) of items" :key="index">{{item}}</li>-->
 <todo-item v-for="(item,index) of items" :key="index" :content="item"></todo-item>
    </ul>
</div>

<script>
Vue.component('todo-item',{
    props:['content'],
 template:'<li>{{content}}</li>'
})
new Vue({
    el:'#root',
 data:{
        items:[],
 inputValue:''
 },
 methods:{
        handleSubmit:function () {
            this.items.push(this.inputValue);
 this.inputValue = ''
 }
    }
})
</script>
</body>
</html>


写回答 关注

3回答

  • 李小柏
    2018-10-18 17:23:37

    。。。

  • NoError2018
    2018-09-19 10:47:52

    我的运行项目看错了 看到了另外一个项目上去

  • NoError2018
    2018-09-18 15:06:24

    已经找到问题了  

    慕沐0269...

    什么原因

    2018-09-19 00:11:48

    共 1 条回复 >

vue2.5入门

快速理解Vue编程理念上手Vue2.0开发。

146174 学习 · 655 问题

查看课程

相似问题