...data 作为template的data 传值在wx:for 中取不到值
发布于 4 年前 作者 xiongxiuying 15248 次浏览 来自 问答

// test.js 页面数据

Page({

    data: {

        test: {

            aaa: 1,

            bb: [{

                id: 1,

                name: ‘qiushi’

            },{

                id:2,

                name: ‘siteng’

            }]

        }

    }

})

//  test.wxml   引用模版

<import src=“parent.wxml” />

<template is=“test” data="{{…test}}" />

// parent.wxml  

<template name=“test”>

    {{aaa}}

    <include src=“item.wxml” />

</template>

// item.wxml

<view>

    {{aaa}}

    <block wx:for="{{bb}}">

        {{item.name}},

        {{aaa}}   //   最后在结果中引用不到aaa

    </block>

</view>

结果:

1

1 qiushi,siteng,

最后在结果中引用不到aaa

2 回复

我也遇到同样的问题,请问大概什么时候修复

谢谢反馈,这里确实有问题

回到顶部