官网教程 https://www.iviewui.com/docs/... 简单易懂css
按照官网撸完会再在咱们的项目中引入你须要的组件(好比button),会发现报以下错:
Cannot read property 'size' of undefinedvue
这是为何呢,都是按照官网一手一脚码的,这时候咱们须要怀疑的精神,直接打开
node_modules/iview/src/components/button/这个文件夹,看看button.vue这里的源码而后找到props.size的undefault方法,将this.$IVIEW打印出来,你就会发现缘由所在node
这个this.$IVIEW 打印出来是undefined,这个就能够解析上面Cannot read property 'size' of undefined的报错了iview
在入口js(main.js)上本身手动给vue.$IVIEW绑定一个空对象ide
import 'iview/dist/styles/iview.css'; import { Button, Table } from 'iview'; Vue.component('Button', Button); Vue.component('Table', Table); //手动给绑定个空对象,就不会报错了 Vue.prototype.$IVIEW = {}