我按照官网给的方法,跟着一步步配置的,最后提示如下:
Uncaught ReferenceError: iView is not defined
at eval (main.js?1c90:10)
at Object../src/main.js (app.js:1320)
at __webpack_require__ (app.js:679)
at fn (app.js:89)
at Object.0 (app.js:1353)
at __webpack_require__ (app.js:679)
at app.js:725
at app.js:728
我的配置是:
main.js文件中
import iView from 'iview';
import 'iView/dist/styles/iview.css';
Vue.use(iView);
.babelrc文件中
"plugins": [["import", {
"libraryName": "iview",
"libraryDirectory": "src/components"
}],"transform-vue-jsx", "transform-runtime"]
package.json文件中已经存在了需要安装的插件跟库,如下:
"iview": "^3.2.2",
"babel-plugin-import": "^1.11.0",
这就是我现在的问题,求大神指点。万分感谢
.babelrc 文件仅需在 iview 组件按需引入时配置,main.js 中 Vue.use(iView) 已将 iview 全局引入~