Vue(ES6)导出变量、常量、方法

lib.js

let bar = '彭于晏'
const isTestServer = true
let fn = function () {
	console.log('有梦想的咸鱼')
}
export { bar, isTestServer, fn }

main.js

import { bar, isTestServer, fn } from './lib'
console.log(bar)
console.log(isTestServer)
console.log(fn)
Logo

前往低代码交流专区

更多推荐