使用自定义标签获取子数组的数据

使用自定义标签获取子数组的数据

假如我想取到organDevice数组下的device对象数组中的devName 填充到设备名称中:
在这里插入图片描述

data :

**organDevices**:[ 
{devId:"000008",
**device** :{ 
deptId:"放射科",-
devId:"000008", 
devModel:	"方舱CT",
**devName**	:"方舱CT"
 },
id:1
organEnCode	:"CS",
organEnName:	"CS",
organId:	"000222",
organId	:"000222",
organName:	"颈椎间盘",
organSort:	"1"} 
]

  

那么可以使用自定义标签:
html:

<script type="text/html" id="device">
  
 				{{#console.log(d)}}
			<span style="font-weight: bold;font-size: 18px;">
					{{ 	d.device.devName }}
 			</span>
		<span style="background: #c9c9c9;border-radius: 3px;"></span>
   		</script>

js:

var organDeviceTable = table.render({
	 	elem: '#dictOrganDevice',
		height: $(window).height() - 230,
		width: ($(window).width() / 5) * 3 - 100,
		cols: [
			[{
					type: 'checkbox',
					fixed: 'left'
				},
			 
				{
					**field: 'devName',**
					**title: '设备名称',**
					**fixed: 'left',**
					**templet: '#device'**
				}, {
					field: 'organEnName',
					width: 130,
					title: '部位名称'
				}, {
					field: 'organEnCode',
					width: 100,
					title: '部位代码'
				}, {
					title: '操作',
					width: 120,
					align: 'center',
					toolbar: '#dictOrganDevice-barDemo',
					fixed: 'right'
				}
			]
		],
		limit: 100000,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值