<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul id="repeat-object" class="demo">
<li v-for="value in object">
{{$key}}:{{value}}
</li>
</ul>
</body>
</html>
<script src="http://cdn.bootcss.com/vue/1.0.12/vue.js">
new Vue({
el:"#repeat-object",
data:{
object:{
FirstName:"John",
LastName:"Doe",
Age: 30
}
}
})
</script>
前端小白,这段代码是从vue的官方教程上抄过来练习的,但是v-for处有错,显示“Attribute v-for is not allowed here”
黄舟2017-04-10 16:43:18
<script type="text/javascript" src="http://cdn.bootcss.com/vue/1.0.12/vue.js"></script>
<script type="text/javascript">
new Vue({
el:"#repeat-object",
data:{
object:{
FirstName:"John",
LastName:"Doe",
Age: 30
}
}
})
</script>
迷茫2017-04-10 16:43:18
看下你的cdn有没有引入成功吧:
<script src="http://cdn.bootcss.com/vue/1.0.12/vue.js">
改成:
<script src="https://cdn.bootcss.com/vue/1.0.12/vue.js">