tiny-vue icon indicating copy to clipboard operation
tiny-vue copied to clipboard

🐛 [Bug]: grid组件的editConfig里的activeMethod方法不支持异步

Open David-TechNomad opened this issue 1 year ago • 3 comments

Version

v3.13.0

Vue Version

v 3.4

Link to minimal reproduction

https://opentiny.design/vue-playground?cmpId=grid-edit&fileName=edit/custom-editing.vue&apiMode=Composition&mode=pc&theme=default

Step to reproduce

grid组件的editConfig里的activeMethod方法不支持异步,现在要双击调接口判断是否能编辑,但是现在用异步不起作用。不支持异步

What is expected

希望grid组件的editConfig里的activeMethod方法支持异步

What is actually happening

grid组件的editConfig里的activeMethod方法不支持异步,现在要双击调接口判断是否能编辑,但是现在用异步不起作用。不支持异步

Any additional comments (optional)

No response

David-TechNomad avatar Feb 06 '24 09:02 David-TechNomad

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: The activeMethod method in the editConfig of the grid component does not support asynchronous

Issues-translate-bot avatar Feb 06 '24 09:02 Issues-translate-bot

function activeMethod({ row }) { return new Promise(resolve => { // 在这里进行异步处理,比如调用接口 setTimeout(() => { // 假设异步操作完成后得到一个结果,true/false const resultFromApi = row.area !== '华东区'; // 假设接口返回 true resolve(Boolean(resultFromApi)); // 将结果转换为布尔值并解决 Promise }, 1000); // 模拟异步操作,1秒后返回结果 }); }

David-TechNomad avatar Feb 06 '24 09:02 David-TechNomad

https://github.com/opentiny/tiny-vue/pull/1407

David-TechNomad avatar Feb 21 '24 07:02 David-TechNomad