fix(apiSelect): remove attribute warning, fixed #2247

This commit is contained in:
无木 2022-10-28 13:31:43 +08:00
parent fd9450304d
commit 5292838fcd
2 changed files with 29 additions and 22 deletions

View File

@ -59,7 +59,7 @@
immediate: propTypes.bool.def(true), immediate: propTypes.bool.def(true),
alwaysLoad: propTypes.bool.def(false), alwaysLoad: propTypes.bool.def(false),
}, },
emits: ['options-change', 'change'], emits: ['options-change', 'change', 'update:value'],
setup(props, { emit }) { setup(props, { emit }) {
const options = ref<OptionsItem[]>([]); const options = ref<OptionsItem[]>([]);
const loading = ref(false); const loading = ref(false);
@ -91,6 +91,13 @@
props.immediate && !props.alwaysLoad && fetch(); props.immediate && !props.alwaysLoad && fetch();
}); });
watch(
() => state.value,
(v) => {
emit('update:value', v);
},
);
watch( watch(
() => props.params, () => props.params,
() => { () => {

View File

@ -460,27 +460,27 @@
span: 8, span: 8,
}, },
}, },
{ // {
field: 'field36', // field: 'field36',
component: 'ApiTree', // component: 'ApiTree',
label: '远程Tree', // label: 'Tree',
helpMessage: ['ApiTree组件', '使用接口提供的数据生成选项'], // helpMessage: ['ApiTree', '使'],
required: true, // required: true,
componentProps: { // componentProps: {
api: treeOptionsListApi, // api: treeOptionsListApi,
params: { // params: {
count: 2, // count: 2,
}, // },
afterFetch: (v) => { // afterFetch: (v) => {
//do something // //do something
return v; // return v;
}, // },
resultField: 'list', // resultField: 'list',
}, // },
colProps: { // colProps: {
span: 8, // span: 8,
}, // },
}, // },
{ {
field: 'divider-linked', field: 'divider-linked',
component: 'Divider', component: 'Divider',