chore: change enum prop type name
This commit is contained in:
parent
e781133016
commit
ac68cb94d2
|
@ -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 | tag,即文本或标签,默认为ViewType.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>;
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue