vue中import的使用

1.引入三方插件

import ElementUI from ‘element-ui’

2.引入css

import ‘iview/dist/styles/iview.css’;

在 style 中引入 css 的方式
<style>
 @import url(../../assets/css/defaultStyle.css);
</style>

3.引入组件

import setGrid from ‘./setGrid’;

4.引入公共方法

单个方法引入

import { stringToEntity} from ‘…/utils/index’;
import { stringToEntity, entityToString } from ‘…/utils/index’;

一组方法引入

import * as orders from ‘…/utils/index’;

index.js

export function stringToEntity() {

}
export function entityToString() {

}

一次只能引入一个方法

import stringToEntity from ‘…/utils/index’;
import entityToString from ‘…/utils/index’;

index.js

export default function stringToEntity() {

}
export default function entityToString() {

}


版权声明:本文为m0_55717177原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。