跳至主要內容

utils 统一出口 index.js

...小于 1 分钟

utils 统一出口 index.js

多个需要导入的文件

// utils/test1.js
export function test1() {
  console.log('test1')
}
export function test2() {
  console.log('test2')
}
// utils/test2.js
export function test3() {
  console.log('test3')
}
export function test4() {
  console.log('test4')
}

统一出口文件

// utils/index.js
export * from './test1'
export * from './test2'

使用

import { test1, test2, test3, test4 } from '@/utils/index'
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.5