关于一个data传值到wxml的问题?
发布于 5 年前 作者 min71 9708 次浏览 来自 官方Issues

Data代码:

data: {
    openSelectRegion:"",
    regionList:{},
    currentType:0,
    address:{
      name:"AA",
      tel:"AA",
      province:"AA",
      city:"AA",
      county:"AA",
      addressDetail:"AA",
      addressIsDefault:false
    },

wxml代码:

<view class="form-item">
      <input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus/>
    </view>
    <view class="form-item">
      <input class="input" bindinput="bindinputMobile" value="{{address.tel}}" placeholder="手机号码" />
    </view>
    <view class="form-item">
      <input class="input" value="{{address.province + address.city + address.county}}" disabled="true" bindtap="chooseRegion" placeholder="省份、城市、区县" />
    </view>
    <view class="form-item">
      <input class="input" bindinput="bindinputAddress" value="{{address.addressDetail}}" placeholder="详细地址, 如街道、楼盘号等" />
    </view>
    <view class="form-default">
      <van-checkbox value="{{ address.addressIsDefault == 1 }}" bind:change="bindIsDefault">设为默认地址</van-checkbox>
    </view>
</view>

效果

3 回复

写个复现代码吧,把你页面现有的这些放进去是有值的

value="{{address.name}}" 获取不到address里的值,不仅是这个,address里的其他值都获取不到
回到顶部