开发者社区 问答 正文

【宜搭】如何获取子表单当前操作行指定组件的值

image.png
需求是在提交的表单数据里,子表单里有个组件是放链接地址的,然后点击后面的详情可以打开链接。
但现在不知道怎么获取当前操作行的指定组件的值

export function onActionClick({ index, groupId, itemValue, actionKey }) {
console.log(actionKey);
const subFormInst = this.$('tableField_mbkgnfok');
// 先获取 行 标识
const items = subFormInst.getItems(); // ["tfitem_1", "tfitem_2"]
items.forEach(item => {
const fieldInst = subFormInst.getComponent(item, 'textField_mbkgnfoo');
console.log(fieldInst.getValue());
alert(fieldInst.getValue())
});
}
上面代码获取到的是子表里该组件的所有值,请问有什么办法实现这个需求吗

展开
收起
1076377145022380 2025-06-06 16:08:51 85 分享 版权
1 条回答
写回答
取消 提交回答
  • 非常简单,你从itemValue中获取值就行了。

    export function onActionClick({ index, groupId, itemValue, actionKey }) {
      console.log(itemValue);// 打印itemValue看下
      this.utils.router.push(itemValue.textField_llq89po4, {}, true, true);// 调用宜搭的路由工具实现链接跳转,替换textField_llq89po4为联系人地址字段的唯一标识
    }
    
    2025-07-16 15:41:23
    赞同 125 展开评论
问答分类:
问答地址:
关联地址: