首页 > 代码库 > js代码中包含vue标签

js代码中包含vue标签

tree组件绘制节点代码报错,babel不认识js代码中的vue标签
renderContent(h, { node, data, store }) {return (<span><span><span>{node.label}</span></span><span style="float: right; margin-right: 20px"><el-button size="mini" on-click={ () => this.append(store, data) }>Append</el-button><el-button size="mini" on-click={ () => this.remove(store, data) }>Delete</el-button></span></span>);}

  

 

-----------------------------------------------------------------------------
在.babelrc文件中

{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}

改成

{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-vue-jsx"],
"comments": false
}

js代码中包含vue标签