1 引入第三方插件
import echarts from 'echarts'
2 引入工具類
第一種是引入單個方法
import {axiosfetch} from './util';下面是寫法,需要export導出
export function axiosfetch(options) {} 第二種 導入成組的方法
import * as tools from './libs/tools'
其中tools.js中有多個export方法,把tools里所有export的方法導入
vue中怎么用呢?
Vue.prototype.$tools = tools
直接用 this.$tools.method調用就可以了
說到這 export 和 export default 又有什么區別呢?
下面看下區別
先是 export
import {axiosfetch} from './util'; //需要加花括號 可以一次導入多個也可以一次導入一個,但都要加括號如果是兩個方法
import {axiosfetch,post} from './util'; 再是 export default
import axiosfetch from './util'; //不需要加花括號 只能一個一個導入
3.導入 css文件
import 'iview/dist/styles/iview.css';
如果是在.vue文件中那么在外面套個style
<style> @import './test.css'; </style>
4.導入組件
import name1 from './name1'import name2 from './name2' components:{ name1, name2, },以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答