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')
大佬能看看什么情况吗
文章讲述了在使用Vue的TypeScript版本开发时,MenuItem组件遇到错误,涉及context中null的content属性读取问题,寻求帮助解决语法错误。
8万+

被折叠的 条评论
为什么被折叠?



