Open franklin-cloud opened 7 years ago
@Lihua93 The "_" is the short name of lodash,import it can resolve the problem.I use the following code in "webpack.base.conf.js" to import the lodash:
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
_: 'lodash'
})
]
@gaohuijue 谢谢老哥,不过我当时直接引入jQuery用原版的ztree了。
Same question here. I installed it with npm and imported it
import Ztree from 'ztree-vue'
registered it as a componentVue.component('ztree', Ztree)
and I get a error as below:Uncaught ReferenceError: _ is not defined at Ztree.created (eval at <anonymous> (app.js:897), <anonymous>:498:10) at Ztree.Vue._callHook (eval at 1 (vendor.bundle.js:655), <anonymous>:8399:21) at Ztree.Vue._init (eval at 1 (vendor.bundle.js:655), <anonymous>:2579:10) at Ztree.Vue._init (eval at 19 (vendor.bundle.js:683), <anonymous>:158:17) at Ztree.Vue._init (eval at 17 (vendor.bundle.js:669), <anonymous>:1756:12) at new Ztree (eval at createClass (eval at 1 (vendor.bundle.js:655)), <anonymous>:2:40) at Directive.build (eval at 1 (vendor.bundle.js:655), <anonymous>:5963:19) at Directive.mountComponent (eval at 1 (vendor.bundle.js:655), <anonymous>:5880:29) at eval (eval at 1 (vendor.bundle.js:655), <anonymous>:5842:14) at eval (eval at 1 (vendor.bundle.js:655), <anonymous>:5860:7)