别名

config/index.js

const path = require('path') // eslint-disable-line
const config = {
  alias: {
    '@/api': path.resolve(__dirname, '..', 'src/api'),
    '@/components': path.resolve(__dirname, '..', 'src/components'),
    '@/assets': path.resolve(__dirname, '..', 'src/assets'),
    '@/store': path.resolve(__dirname, '..', 'src/store')
  }
}

根目录下jsconfig.json

"paths": {
  "@/api": ["src/api"],
  "@/components": ["src/components"],
  "@/assets": ["src/assets"],
  "@/store": ["src/store"],
}
posted @ 2021-04-28 14:02  tulintao  阅读(88)  评论(0编辑  收藏  举报