build(pinia): Add pinia

build(vite-plugin-vue-setup-extend): Delete vite-plugin-vue-setup-extend

build(unplugin-auto-import): Delete unplugin-auto-import

build(unplugin-vue-components): Delete unplugin-vue-components

build(vite-plugin-style-import): Add vite-plugin-style-import
This commit is contained in:
kailong321200875
2021-12-11 11:46:10 +08:00
parent 2c41826c57
commit 2040500af1
23 changed files with 683 additions and 416 deletions

18
src/utils/index.ts Normal file
View File

@@ -0,0 +1,18 @@
import type { App, Plugin } from 'vue'
/**
*
* @param component 需要注册的组件
* @param alias 组件别名
* @returns any
*/
export const withInstall = <T>(component: T, alias?: string) => {
const comp = component as any
comp.install = (app: App) => {
app.component(comp.name || comp.displayName, component)
if (alias) {
app.config.globalProperties[alias] = component
}
}
return component as T & Plugin
}

View File

@@ -1,20 +0,0 @@
import { createTypes, VueTypesInterface } from 'vue-types'
// 自定义扩展vue-types
type PropTypes = VueTypesInterface & {}
const propTypes: PropTypes = createTypes({
func: undefined,
bool: undefined,
string: undefined,
number: undefined,
object: undefined,
integer: undefined,
array: undefined
})
// 需要自定义扩展的类型
// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
propTypes.extend([])
export { propTypes }

31
src/utils/propTypes.ts Normal file
View File

@@ -0,0 +1,31 @@
import { createTypes, VueTypesInterface, VueTypeValidableDef } from 'vue-types'
import { CSSProperties } from 'vue'
// 自定义扩展vue-types
type PropTypes = VueTypesInterface & {
readonly style: VueTypeValidableDef<CSSProperties>
}
const propTypes = createTypes({
func: undefined,
bool: undefined,
string: undefined,
number: undefined,
object: undefined,
integer: undefined
}) as PropTypes
console.log(propTypes.array)
// 需要自定义扩展的类型
// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
propTypes.extend([
{
name: 'style',
getter: true,
type: [String, Object],
default: undefined
}
])
export { propTypes }