vueJs出现Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as
模板应该只负责将状态映射到ui。避免在模板中放置带有副作用的标记,例如
错误代码:
<body>
<div id="app">
<mycom1>
</mycom1>
<script>
Vue.component('mycom1',{
template:'<h3>Vue.extend创建的组件</h3>'
})
var vm=new Vue({
el:' #app',
})
</script>
</div>
</body>
原因:
原因是你新建VUE实例的代码放在了被绑定的组件
,将’<‘script>标签写到’<'body>’外