vue按需引入element Transfer 穿梭框

摘要: vue按需引入element Transfer 穿梭框

按需引入Transfer

编辑main.js

1
2
3
4
5
6
7
8
9
10
11
import {
...
Transfer
} from 'element-ui';
const components = [
...
Transfer
];
components.map(component => {
Vue.component(component.name, component);
});

安装transform-vue-jsx 插件

编辑 .babelrc文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": [["component", [
{
"libraryName": "element-ui",
"styleLibraryName": "theme-default"
}
]], "transform-runtime", "transform-vue-jsx"],
"comments": false
}

安装相应插件

1
2
3
npm install  babel-plugin-syntax-jsx --save-dev
npm install babel-plugin-transform-vue-jsx --save-dev
npm install babel-helper-vue-jsx-merge-props --save-dev

评论