buqiyuan / vue3-antdv-admin

基于 vite5.x + vue3.x + ant-design-vue4.x + typescript hooks 的基础后台管理系统 RBAC的权限系统, JSON Schema动态表单,动态表格,锁屏界面
https://vue3-antdv-admin.pages.dev/
MIT License
3.54k stars 860 forks source link

怎么给 Select 动态赋值 #74

Closed tiantianliulang closed 7 months ago

tiantianliulang commented 2 years ago

image image image

我输出有值的,但是下拉框里没数据,我的写法有问题嘛,谢谢

buqiyuan commented 2 years ago

image 暂时先使用request方法进行异步数据填充吧!

buqiyuan commented 2 years ago

正常更新表单的值,需要通过调用表单内部的updateSchema来进行更新,目前我遗漏了将DynamicTable的QueryForm实例方法对外暴露了

buqiyuan commented 2 years ago

已更新 代码变动位置:https://github.com/buqiyuan/vue3-antd-admin/blob/75c9f557b19b00bfd8516246b56e9eeec127dd24/src/components/core/dynamic-table/dynamic-table.vue#L280 使用示例:https://github.com/buqiyuan/vue3-antd-admin/blob/75c9f557b19b00bfd8516246b56e9eeec127dd24/src/views/demos/tables/wzry-table/index.vue#L68

tiantianliulang commented 2 years ago

OK 谢谢

stevenliu87 commented 2 years ago

tiantianliulang 你的问题解决了吗 我也有这样的问题 onSearch : async (val: string) =>{ const optionSel=[] as Array
const list = await getListApporgcode({ apporgcode: val });

 list.list.map((item)=>(
  console.log(item),
  optionSel.push({ label: item.apporgname, value: item.apporgcode })
 ));
 options: optionSel;   

}, 下拉框里不显示

tiantianliulang commented 2 years ago

tiantianliulang 你的问题解决了吗 我也有这样的问题 onSearch : async (val: string) =>{ const optionSel=[] as Array const list = await getListApporgcode({ apporgcode: val });

 list.list.map((item)=>(
  console.log(item),
  optionSel.push({ label: item.apporgname, value: item.apporgcode })
 ));
 options: optionSel;   

}, 下拉框里不显示

解决了啊 看上面 作者已经说的很详细了

stevenliu87 commented 2 years ago

是在做 新增功能,表单提交时用的,在onSearch : async (val: string) =>{里写的,能显示吗