jeecg v3 表格自定义按钮打开Modal并传参

1.在template里加入

<UrAdspotsMapModal @register="register4" />
  

2.在脚本中import

import UrAdspotsMapModal from './components/UrAdspotsMapModal.vue'
  

3.在script里注册

const [register4, { openModal: openModal4 }] = useModal();
  

4.在函数里调用

function handleMapDetail(record: Recordable) {
  openModal4(true, {
    record
  });
}
  

5.在Action列引用

function getTableAction(record){
  return [{
      label: '地图',
      onClick: handleMapDetail.bind(null, record),
      }
    ]
}
  

6.Modal页面

<BasicForm @register="registerForm" :model="model" />

setup(props) {
const modelRef = ref({});
modelRef.value = { field2: data.record.lat, field1: data.record.lng };
return { ...,model: modelRef,...};

 

posted @ 2024-09-19 15:18  meetrice  阅读(89)  评论(0编辑  收藏  举报