模板data="" 为什么不能传对象的某个属性-该属性值为一个Number类型
发布于 7 年前 作者 yanyan 6513 次浏览 来自 问答

```html

<view class=“weui-media-box weui-media-box_appmsg” hover-class=“weui-cell_active”

wx:for="{{panelList}}" wx:for-index=“idx” wx:key=“idx”>

<view class=“weui-media-box__hd weui-media-box__hd_in-appmsg”>

<image class=“weui-media-box__thumb” src="{{item.imgUrl}}" />

view>

<view class=“weui-media-box__bd weui-media-box__bd_in-appmsg”>

<view class=“weui-media-box__title”>

<view class=“title-txt”>{{item.name}}view>

<view class=“status online” wx:if="{{item.state.length > 0}}">{{item.state}}view>

{{item.star}}

<template is=“star” data="{{item.star}}">template>

view>

<view class=“weui-media-box__desc”>{{item.info}}view>

view>

view>

```

为什么不能这样传递呢?

1 回复

不应该这样传值,正确的传值方法是:data = ‘star:item.star’

回到顶部