报错内容:
Extraneous non-props attributes (data-genuitec) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
代码:
<html>
<head>
<title>组件Prop验证</title>
</head>
<body>
<script src="https://unpkg.com/vue@next"></script>
<div id="app">
<!-- <html-a v-bind:parent-message="100"></html-a> -->
<html-a parent-message="c"></html-a>
</div>
<script>
//局部组件
const htmlA = {
data(){
return {
message:'子组件Vue3.x~'
}
},
props:{
parentMessage:{
type : [String,Number],
default(){
return 200
},
validator(value){
return ['a','b','c'].indexOf(value)!==-1
}
}
},
//模板
template :`
<div>{{parentMessage}}</div>
<div>{{message}}</div>
`
}
const app = Vue.createApp({
data(){
return{
message:'父组件Vue3.x~'
}
},
components:{
'html-a':htmlA
}
})
app.mount('#app')
</script>
</body>
</html>
事实上这段代码我放到vscode中打开Chrome预览就没有这样的错误,但是从eclipse中打开就会报错
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。