该步骤基于https://www.iviewui.com/docs/guide/install 定制主题
- C:UsersAdministrator> cnpm i vue-cli -g
- F:iview-demos> vue init webpack demo1
- F:iview-demosdemo1> cnpm install iview --save
- F:iview-demosdemo1> cnpm i less style-loader css-loader less-loader -D
- F:iview-demosdemo1> cnpm install iview-loader --save-dev
- 在build/webpack.base.conf.js中的extensions
1 resolve: { 2 extensions: ['.js', '.vue', '.json'], 3 alias: { 4 'vue$': 'vue/dist/vue.esm.js', 5 '@': resolve('src'), 6 } 7 },
需要增加一个.less:
1 resolve: { 2 extensions: ['.js', '.vue', '.json', '.less'], 3 alias: { 4 'vue$': 'vue/dist/vue.esm.js', 5 '@': resolve('src'), 6 } 7 },
- 在build/webpack.base.conf.js中的module, 改写平时 vue-loader 的配置,如下:
module: { rules: [ { test: /.vue$/, use: [ { loader: 'vue-loader', options: { } }, { loader: 'iview-loader', options: { prefix: false } } ] } ] }
- F:iview-demosdemo1> cnpm init
- F:iview-demosdemo1> cnpm run dev