这是根据传入的参数来判断应该渲染的图标,注意,不论在哪里,props中的属性都因该规范书写,至少提供默认值和类型,eslint检查就不会报缺少默认值的错误了。
import Vue from 'vue'
Vue.component('render-dom', {
props: {
row: {
type: Object,
default: function() {
return {
}
}
},
render: {
type: Object,
default: function() {
return {
}
}
},
index: {
type: Number,
default: 0
},
column: {
type: Object,
default: function() {
return {
}
}
}
},
methods: {
handleClick(ev) {
ev.stopPropagation()
alert('hah')
}
}