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>’外

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐