|
|
@@ -1,4 +1,4 @@
|
|
|
-import { defineComponent } from 'vue'
|
|
|
+import { defineComponent, ref } from 'vue'
|
|
|
import { LoadingOutlined, ReloadOutlined } from '@ant-design/icons-vue'
|
|
|
|
|
|
/* 此代码导出一个名为“ReloadIconTsx”的 Vue
|
|
|
@@ -83,3 +83,44 @@ export const IconTsx = defineComponent({
|
|
|
)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+export const SelectTsx = defineComponent({
|
|
|
+ name: 'select-tsx',
|
|
|
+ props: {
|
|
|
+ modelValue: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ default: () => ({})
|
|
|
+ },
|
|
|
+ request: {
|
|
|
+ type: Function,
|
|
|
+ default: () => {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ emits: ['update:modelValue'],
|
|
|
+ setup (props, context) {
|
|
|
+ const list = ref<{
|
|
|
+ name: string,
|
|
|
+ value: any,
|
|
|
+ key: string
|
|
|
+ }[]>([])
|
|
|
+
|
|
|
+ props.request().then((r: {
|
|
|
+ name: string,
|
|
|
+ value: any,
|
|
|
+ key: string
|
|
|
+ }[]) => {
|
|
|
+ list.value = r
|
|
|
+ })
|
|
|
+
|
|
|
+ const onInput = (value: string) => context.emit('update:modelValue', value)
|
|
|
+
|
|
|
+ return () => (
|
|
|
+ <a-select value={props.modelValue} onChange={(value: string) => onInput(value)}>
|
|
|
+ {
|
|
|
+ list.value.map(item => <a-select-option key={item.key} value={item.value}>{item.name}</a-select-option>)
|
|
|
+ }
|
|
|
+ </a-select>
|
|
|
+ )
|
|
|
+ }
|
|
|
+})
|