Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用ant-design-vue的表格列,最后一列使用自定义渲染,在预览模式展示有问题 #65

Open
lyllovelemon opened this issue May 16, 2023 · 0 comments
Assignees

Comments

@lyllovelemon
Copy link

lyllovelemon commented May 16, 2023

复现步骤

  1. 拖入ant-design-vue的自定义表格组件,默认有数据展示,表格列增加一项,操作列,开启自定义渲染
  2. 出现如下插槽组件
    image

3.将文字按钮组件拖入插槽处
image
4. 按钮绑定事件,传入参数,其中事件的传入参数为{ "data": this.data.record },在methods中定义按钮绑定事件,将操作列的参数传入并赋值给当前项变量
image
5. 拖入对话框-普通型组件,绑定是否可见为showDetail,在对话框中拖入2个文本,分别绑定为
this.currentRow.name和this.currentRow.address
image
6. 点击预览按钮,在页面点击详情,不断出现如下告警,对话框没有正常展示

image

预期

预览模式中点击详情按钮可以正常展示对话框,并且文本数据正确渲染

源码面板js

import { defineComponent,toRaw } from 'vue';

export default defineComponent({
props: {
style: {
type: Object,
default: {}
},
},
data: () => ({
text: "outer",
showDetail: false,
searchVal:'',
currentRow:{},
allList: [{
"id": "1",
"name": "毛不易",
"age": 32,
"address": "西湖区湖底公园1号",
"tag":"幼鸟指南"
}, {
"id": "2",
"name": "邓紫棋",
"age": 28,
"address": "滨江区网商路699号",
"tag":"高音天后"
}],
userList: [],
}),
methods: {
onDetail(e,data){
this.currentRow = toRaw(data);
console.log('打开详情', this.currentRow,data);
this.showDetail = true;
},
onCloseDetail(){
this.showDetail = false;
},
testFunc() {
console.log('test func');
},
filterList(){
if(!this.searchVal) {
this.userList = [...this.allList];
return;
}
const origin = [...this.allList];
this.userList = origin.filter(item=>{
return item.name === this.searchVal;
})
},
onSelectChange(val,option){
this.searchVal = option.label?option.label:'';
this.filterList();
},
onDeselect(e){
console.log('取消选中',e);
},
expandedRowRender(record,index){
console.log('record',record);
return ${record.tag};
}
},
mounted() {
this.userList = [...this.allList];
console.log('did mount');
},
beforeMount() {
console.log('will unmount');
},
})

@lyllovelemon lyllovelemon changed the title 表格组件自定义渲染拖入其他组件持续告警导致页面卡死 使用ant-design-vue的表格列,最后一列使用自定义渲染,在预览模式展示有问题 May 16, 2023
@keuby keuby self-assigned this May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants