1. vue.runtime.esm.js:1240 [Vue warn]: Component emitted event "click" but it is neither declared in the emits option nor as an "onClick" prop.
组件发出事件“click”,但它既没有在emit选项中声明,也没有作为“onClick”道具声明。
正确代码 vue2
this.$emit('click', {
index: dataset.index
});
错误代码 只在子组件声明 -vue3 setup
const emits = defineEmits(['chooseCancel','click'])
emits('click', {
index: dataset.index
})
要在父组件声明
<aaa @click='click'></aaa>
import aaa from '/components/aaa/aaa.vue'
const click=(e)=>{
console.log(e.index)
}
2.Unexpected semicolon at the end of 'color' style value: '#361D11;' --警告
起因,在父组件定义desC:'#361D11',在子组件中动态使用:style="{color: list.titleC}"导致错误生成
结论: desC:'color: #361D11;' ,将color也写进来,如果需要单独使用‘ #361D11’,无法解决