暨 vue 中使用模板(如ant中使用的)vue
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "ReferenceError: h is not defined" found in ---> <TableCell> <BodyRow> <TableRow> <ConnectTableRow>
==解决==git
灵感来源: [](https://github.com/elbywan/bo...github
<script> export default { ... // h gets auto injected here (note that data is now a member function) data() { return { selection: [], model: [ { label: "One" }, { label: "Two" }, { label: "Three", list: [ { label: "Four" }, { label: "Five" } ] } ], category: "list", // Move 'display' here display: item => <strong>item.label</strong> } } } </script>
看这个这行注释:babel
h gets auto injected here (note that data is now a member function)
,框架
那就是说, vue 文件的方法, 就会自动收到 babel 注入 h
了?(h
是什么? 这是 JSX
的约定, 默认会自动注入到方法的第一个参数: ue JSX assumes that you pass
h` as the first parameter of your render function.
It will use h
to dynamically create all your components. `)spa
上述错误时, 个人JSX模板配置是另起config.js
文件中, 在vue中 import xxx from './config.js
的, 这就是说, 极可能是由于这种方式, vue等框架没有给个人配置加强, 致使方法没有注入`h' .code
那, 我将个人配置挪到 data(){return {xx: Jsx模板配置}}
中试试.component
果真. oooooooooooook!blog