chore: change enum prop type name

This commit is contained in:
aalizzwell 2022-10-03 16:00:14 +08:00
parent e781133016
commit ac68cb94d2
3 changed files with 50 additions and 31 deletions

View File

@ -1,6 +1,9 @@
import { ExtractPropTypes } from "vue";
import { ViewType, EnumTypeProp } from './types';
import { ViewType, EnumType } from './types';
/**
*
*/
export const comboListProps = {
/**
*
@ -50,6 +53,21 @@ export const comboListProps = {
*
* text | tagViewType.Text
*/
viewType: EnumTypeProp(ViewType.Text, ViewType),
viewType: EnumType(ViewType.Text, ViewType),
/**
*
*/
mapFields: Object,
/**
*
*/
data: Array,
idField: {
type: String,
default: 'id'
},
valueField: {
}
};
export type ComboListProps = ExtractPropTypes<typeof comboListProps>;

View File

@ -1,3 +1,4 @@
import Constructor, { } from 'vue';
/**
*
*/
@ -11,7 +12,7 @@ export enum ViewType {
* @param enumType
* @returns
*/
export function EnumTypeProp<T extends string | number>(defaultValue: T, enumType: Record<symbol, T>) {
export function EnumType<T extends string | number>(defaultValue: T, enumType: Record<symbol, T>) {
return {
default: defaultValue,
validator: (value: T) => Object.values(enumType).includes(value)

View File

@ -20,46 +20,46 @@ const canAutoComplete = ref(false);
</script>
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Vite + Vue" />
<!-- <input type="checkbox" id="checkbox" v-model="canEdit" />
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Vite + Vue" />
<!-- <input type="checkbox" id="checkbox" v-model="canEdit" />
<label for="checkbox">editable:{{ canEdit }}</label>
<input type="checkbox" id="checkbox" v-model="canAutoComplete" />
<label for="checkbox">auto complete:{{ canAutoComplete }}</label> -->
<!-- <ButtonEdit :editable="canEdit" :auto-complete="canAutoComplete" :enable-clear="true"></ButtonEdit> -->
<ButtonEdit></ButtonEdit>
<Avatar></Avatar>
<input type="checkbox" id="checkbox" v-model="disable" />
<label for="checkbox">disable:{{ disable }}</label>
<FButton :disable="disable"></FButton>
<Switch></Switch>
<RadioGroup></RadioGroup>
<Section></Section>
<Notify></Notify>
<Accordion></Accordion>
<Tabs />
<ComboList />
<!-- <ButtonEdit :editable="canEdit" :auto-complete="canAutoComplete" :enable-clear="true"></ButtonEdit> -->
<ButtonEdit></ButtonEdit>
<Avatar></Avatar>
<input type="checkbox" id="checkbox" v-model="disable" />
<label for="checkbox">disable:{{ disable }}</label>
<FButton :disable="disable"></FButton>
<Switch></Switch>
<RadioGroup></RadioGroup>
<Section></Section>
<Notify></Notify>
<Accordion></Accordion>
<Tabs />
<ComboList />
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>