vue element pro components
1.0.0
npm i vue-element-pro-components -s
# 或者
yarn add vue-element-pro-components -s
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue . use ( Element )
import VueElementProComponents from 'vue-element-pro-components'
import 'vue-element-pro-components/lib/theme/index.css'
Vue . use ( VueElementProComponents )
babel-plugin-import
# yarn 方式安装
yarn add babel-plugin-import -D
# npm 方式安装
npm install babel-plugin-import -D
{
...
plugins : [
[
"import" ,
{
libraryName : "vue-element-pro-components" ,
// 默认打包是lib,不用更改
libraryDirectory : "lib" ,
// 如果有样式文件,因为打包后样式统一放在/lib/theme下,所以需要稍微转换下
style : ( name , file ) => {
const libDirIndex = name . lastIndexOf ( "/" ) ;
const libDir = name . substring ( 0 , libDirIndex ) ;
const fileName = name . substr ( libDirIndex + 1 ) ;
return ` ${ libDir } /theme/ ${ fileName } .css` ;
} ,
} ,
] ,
] ,
}
Selanjutnya, jika Anda hanya ingin memperkenalkan beberapa komponen, seperti Dialog
dan Form
, maka Anda perlu menulis yang berikut di main.js
:
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue . use ( Element )
import { Dialog , Form } from 'vue-element-pro-components'
Vue . use ( Dialog )
Vue . use ( Form )
/* 或写为
* Vue.component(Dialog.name,Dialog)
* Vue.component(Form.name,Form)
*/
new Vue ( {
el : '#app' ,
render : ( h ) => h ( App )
} )
Atau semua memperkenalkan
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue . use ( Element )
import {
Dialog ,
Form ,
Pagination ,
Search ,
Table ,
AdvancedSearch ,
Drawer
} from 'vue-element-pro-components'
Vue . use ( Dialog )
Vue . use ( Form )
Vue . use ( Pagination )
Vue . use ( Search )
Vue . use ( Table )
Vue . use ( AdvancedSearch )
Vue . use ( Drawer )
https: // fang- kang.github.io/vue-element- komponen
Jika Anda suka pr
merasa berguna star
Anda dapat memesan bug
.