types: 修复全局组件属性类型无法推导
This commit is contained in:
parent
c29d1cb4c6
commit
94160c0418
|
@ -3,7 +3,6 @@
|
||||||
/dist*
|
/dist*
|
||||||
/public/*
|
/public/*
|
||||||
/docs/*
|
/docs/*
|
||||||
/vite.config.ts
|
|
||||||
/src/types/env.d.ts
|
/src/types/env.d.ts
|
||||||
/docs/**/*
|
/docs/**/*
|
||||||
/plop/**/*
|
/plop/**/*
|
||||||
|
|
|
@ -43,8 +43,8 @@ const save = async () => {
|
||||||
<BaseButton @click="go(-1)">
|
<BaseButton @click="go(-1)">
|
||||||
{{ t('common.back') }}
|
{{ t('common.back') }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
<BaseButton type="primary" :loading="loading" @click="save">
|
<BaseButton type="primary" :loading="loading" @click="save"
|
||||||
{{ t('exampleDemo.save') }}
|
>{{ t('exampleDemo.save') }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</template>
|
</template>
|
||||||
</ContentDetailWrap>
|
</ContentDetailWrap>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
Icon: (typeof import('../components/Icon/src/Icon.vue'))['default']
|
Icon: (typeof import('../src/components/Icon/index'))['Icon']
|
||||||
Permission: (typeof import('../components/Permission/src/Permission.vue'))['default']
|
Permission: (typeof import('../src/components/Permission/index'))['Permission']
|
||||||
BaseButton: (typeof import('../components/Button/src/Button.vue'))['default']
|
BaseButton: (typeof import('../src/components/Button/index'))['BaseButton']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ import Vue from '@vitejs/plugin-vue'
|
||||||
import VueJsx from '@vitejs/plugin-vue-jsx'
|
import VueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import progress from 'vite-plugin-progress'
|
import progress from 'vite-plugin-progress'
|
||||||
import EslintPlugin from 'vite-plugin-eslint'
|
import EslintPlugin from 'vite-plugin-eslint'
|
||||||
import { ViteEjsPlugin } from "vite-plugin-ejs"
|
import { ViteEjsPlugin } from 'vite-plugin-ejs'
|
||||||
import { viteMockServe } from 'vite-plugin-mock'
|
import { viteMockServe } from 'vite-plugin-mock'
|
||||||
import PurgeIcons from 'vite-plugin-purge-icons'
|
import PurgeIcons from 'vite-plugin-purge-icons'
|
||||||
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||||
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
||||||
import UnoCSS from 'unocss/vite'
|
import UnoCSS from 'unocss/vite'
|
||||||
|
@ -24,7 +24,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||||
let env = {} as any
|
let env = {} as any
|
||||||
const isBuild = command === 'build'
|
const isBuild = command === 'build'
|
||||||
if (!isBuild) {
|
if (!isBuild) {
|
||||||
env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root)
|
env = loadEnv(process.argv[3] === '--mode' ? process.argv[4] : process.argv[3], root)
|
||||||
} else {
|
} else {
|
||||||
env = loadEnv(mode, root)
|
env = loadEnv(mode, root)
|
||||||
}
|
}
|
||||||
|
@ -41,16 +41,18 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||||
progress(),
|
progress(),
|
||||||
createStyleImportPlugin({
|
createStyleImportPlugin({
|
||||||
resolves: [ElementPlusResolve()],
|
resolves: [ElementPlusResolve()],
|
||||||
libs: [{
|
libs: [
|
||||||
libraryName: 'element-plus',
|
{
|
||||||
esModule: true,
|
libraryName: 'element-plus',
|
||||||
resolveStyle: (name) => {
|
esModule: true,
|
||||||
if (name === 'click-outside') {
|
resolveStyle: (name) => {
|
||||||
return ''
|
if (name === 'click-outside') {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
||||||
}
|
}
|
||||||
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
}),
|
}),
|
||||||
EslintPlugin({
|
EslintPlugin({
|
||||||
cache: false,
|
cache: false,
|
||||||
|
@ -81,8 +83,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||||
ViteEjsPlugin({
|
ViteEjsPlugin({
|
||||||
title: env.VITE_APP_TITLE
|
title: env.VITE_APP_TITLE
|
||||||
}),
|
}),
|
||||||
UnoCSS(),
|
UnoCSS()
|
||||||
// sveltekit(),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
css: {
|
css: {
|
||||||
|
@ -125,7 +126,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:8000',
|
target: 'http://127.0.0.1:8000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hmr: {
|
hmr: {
|
||||||
|
|
Loading…
Reference in New Issue