render函数传递了一个createElement参数,并返回了一段Dom节点片段
语法
<scripts>
export default {
render: createElement => {
return createElement('div', {
style: {
width: '100px',
...
},
class: {
person: true,
morePerson : true,
bg: false
},
attribute: {
dataName: 'personVal',
...
},
props: {
age: 18,
...
},
domProps: {
innerHTML: '这是一段测试代码'
}
})
}
}
</scripts>
<style scoped>
.person {
width: 100%;
height: 100px;
background: blue
}
.more-person {
font-size: 30px;
}
.bg {
background: no
}
</style>