iview的使用入門

(1)在git bash中安裝iview,即:css

npm install iview --save

(2)在main.js中引用並註冊iView,即:vue

import iView from 'iview'
import 'iview/dist/styles/iview.css'

Vue.use(iView)

(3)爲了統一IView標籤的書寫規範,經過安裝iView Loader,即:node

npm install iview-loader --save

而後修改webpack選項,以下:webpack

 1 rules: [
 2    ...(config.dev.useEslint ? [createLintingRule()] : []),
 3    {
 4      test: /\.vue$/,
 5      use: [
 6        {
 7          loader: 'vue-loader',
 8          options: vueLoaderConfig
 9        },
10        {
11          loader: 'iview-loader',
12          options: {
13              prefix: false
14          }
15        }
16      ]
17      
18    },
19    {
20      test: /\.js$/,
21      loader: 'babel-loader',
22      include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
23 }
相關文章
相關標籤/搜索