项目场景:
使用jeecg-boot二开,列表页打开详情页,打开两个问题,相关源代码如下。
问题描述
以下为部分代码,点击姓名跳转详情页
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '照片',
align: 'center',
dataIndex: '照片',
customRender: function (t, r, index) {
if (t && !t.includes('http')) {
t = '/jeecg-boot/sys/common/static/' + t
}
return <img class='photo' src={t} />
}
},
{
title: '姓名',
align: 'center',
dataIndex: '姓名',
customRender: function (t, r, index) {
let url = '/people_manage/detail?id=' + r.id
return <router-link to={url}>{t}</router-link>
}
}
原因分析:
不清楚,先记录下
以下为详细原因:无
解决方案:
这个是前端大佬解决的,记录
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '照片',
align: 'center',
dataIndex: '照片',
customRender: function (t, r, index) {
if (t && !t.includes('http')) {
t = '/jeecg-boot/sys/common/static/' + t
}
return <img class='photo' src={t} />
}
},
{
title: '姓名',
align: 'center',
dataIndex: '姓名',
customRender: function (t, r, index) {
let url = '/people_manage/detail'
return <router-link to={ { path: url, params: { id: r.id } }}>{t}</router-link>
}
}