vue-element-admin error in ./src/layout/components/Sidebar/Item.vue Syntax Error: Unexpected token (21:8)

jgzswidk  于 2022-10-20  发布在  其他
关注(0)|答案(4)|浏览(528)

Question(提问)

我引用了Layout组件之后出现如下报错:

该段的源代码如下:
`
export default {
name: 'MenuItem',
functional: true,
props: {
icon: {
type: String,
default: ''
},
title: {
type: String,
default: ''
}
},
render(h, context) {
const { icon, title } = context.props
const vnodes = []

if (icon) {
  vnodes.push(
    <svg-icon icon-class={icon}/>
  )
}

if (title) {
  vnodes.push(
    <span slot='title'>{(title)}</span>
  )
}
return vnodes

}
}

`

3xiyfsfu

3xiyfsfu1#

我也遇到了相同的问题, 同问

chhqkbe1

chhqkbe13#

It's sth wrong about Babel settings, please ensure your babel.config.js looks like below

module.exports = {
  presets: [
    '@vue/app'
  ]
}

相关问题