v-if=“hostsList && !error”
border
ref=“selection”
:columns=“columns”
:data=“hostsList”
@on-selection-change=“tableSelection”
@on-select=“tableSelect”
初始化data中返回的数据
columns: [ //表格头部 信息 id hostname tags loc idc status
{
type: ‘selection’,
width: 60,
align: ‘center’,
},
{
title: ‘机器名称’,
key: ‘hostname’,
width: 200,
render: (h, params) => {
let data =params.row;
let url = ‘’;
if(data.idc === ‘uclcn’ || data.idc === ‘alicn’ || data.idc === ‘tencn’) {
url = http://${data.hostname}:1988
} else {
url = http://${data.ip}:1988
}
return h(‘a’,
{
domProps:{
href: url,
target:‘_blank’
}
},
data.hostname
)
}
},
{
title: ‘机器IP’,
key: ‘ip’,
width:150,
align: ‘center’,
},
{
title: ‘机器类型’,
key: ‘type’,
width:150,
align: ‘center’,
render: (h, params) => {
console.log( 99999, h ,params)
let data = params.row;
let type = ‘’
if (data.type == ‘commodo’) {
type = ‘虚拟机’
} else {
type = ‘容器’
}
return h(‘div’,
{},
type
)
}
},