vue源代码
<script lang="ts">
export default {
name: 'MenuItem',
functional: true,
props: {
icon: {
type: String,
default: ''
},
title: {
type: String,
default: ''
}
},
render(h, context) {
const { icon = '', title = '' } = context ? context.props : {}
const vnodes = []
if (icon) {
vnodes.push(<svg-icon icon-class={icon} />)
}
if (title) {
vnodes.push(<span slot='title'>{(title)}</span>)
}
return vnodes
}
}
</script>
报错
ERROR Failed to compile with 1 error 23:41:39
error in ./src/layout/components/Sidebar/Item.vue?vue&type=script&lang=ts
Syntax Error: TypeError: Cannot read properties of null (reading 'content')
大佬能看看什么情况吗