- vant的输入框组件为什么不能正常传值?
输入框输入的内容绑定了item.comments,打印出来是null。我这其他地方也用了vant的输入框,但是那些可以传值 wxml: [图片] js: [图片]
2022-03-17 - 如何将卡片的值传入弹出框?
如图,想通过点击卡片上的详情,弹出具体信息。因为这个是看某个人的订单,订单总数不会太多,所以我的想法是把卡片对应订单的id传到弹出框,弹出框再用wx:if确定订单展示。 我没有前端的基础,这方面基本不懂,还请指教。 [图片] [图片] 卡片的wxml代码: <view class="order_box" style="height:180px;opacity: 0.85;margin-top:5%;margin-left:16%;margin-bottom: 7%;" wx:for="{{orderList}}" wx:key="oid" wx:if="{{item.ispay===1&&item.ostatus!==2}}"> <van-card desc="订单号:{{item.oid}}" num="{{item.count}}" price="{{item.money}}" title-class="cardTitle" num-class="cardNum" desc-class="cardDesc" > ...... </van-card> </view> 弹出框: <van-dialog use-slot title="订单详情" show="{{ showDetail }}" > <van-cell-group> ...... </van-cell-group> </van-dialog> 弹出框相关的js: data: { showDetail: false, ...... } showDetailDialog(){ this.setData({ showDetail: true}); },
2022-03-13 - 如何使用弹出框显示详细信息?
如图,已经做到用wx:for在卡片上显示某一订单的部分信息,我希望可以通过点击红框内按钮的方式显示该订单详细信息,但是目前还无法显示。使用的是vant。 [图片][图片] wxml代码: <van-tabs active="{{ active }}" bind:change="onChange" animated> <van-tab title="未送达"> <scroll-view scroll-y="true" style="height: 900rpx; margin-top: 45rpx;"> <view class="order_box" style="height: 400px;opacity: 0.85;margin-top:5%;margin-left:16%;margin-bottom: 5%;" wx:for="{{orderList}}" wx:key="oid" wx:if="{{item.ispay===1}}"> <van-card desc="订单号:{{item.oid}}" title="{{item.oname}}" num="{{item.count}}" price="{{item.money}}" desc-class="cardDesc" > <view slot="footer"> <button class="box_btn" bindtap="showDetailDialog" size="mini">详情</button> <button class="box_btn" size="mini" bindtap="orderReminder">催单</button> </view> </van-card> </view> </scroll-view> </van-tab> ...... </van-tabs> 下面是这个弹出框的代码: <van-dialog use-slot title="订单详情" show="{{ showDetail }}" > <van-cell-group> <van-cell title="订单号" value="{{item.oid}}"/> <van-cell title="目的地址" value="{{item.daddress}}"></van-cell> <van-cell title="货物名" value="{{item.oname}}"></van-cell> <van-cell title="货物重量" value="{{item.weight}}"></van-cell> <van-cell title="货物数量" value="{{item.count}}"></van-cell> <van-cell title="货物类别" value="{{item.cclass}}"></van-cell> <van-cell title="加急" value="{{item.ishurry}}" title-width="300rpx"> <van-radio-group value="{{ radio }}" bind:change="onChange" direction="horizontal" disabled > <van-radio name="1" shape="square" label-position="left">是</van-radio> <van-radio name="0" shape="square" label-position="left">否</van-radio> </van-radio-group> </van-cell> <van-cell title="易碎" value="{{item.isfragile}}" title-width="300rpx"> <van-radio-group value="{{ radio }}" bind:change="onChange" direction="horizontal" disabled > <van-radio name="1" shape="square" label-position="left">是</van-radio> <van-radio name="0" shape="square" label-position="left">否</van-radio> </van-radio-group> </van-cell> <van-cell title="支付金额" value="{{item.money}}"></van-cell> <van-cell title="备注" value="{{item.tips}}"></van-cell> <van-cell title="创建日期" value="{{item.otime}}" /> </van-cell-group> </van-dialog> 没有前端经验,拜托各位了......
2022-03-10 - 这里card的间距为什么这么大?该怎么解决?
使用的是vant组件模板,之前在wxml写死数据的时候间距正常,尝试wx:for循环后成了这样[图片] 之前:[图片] wxml代码: <van-tabs active="{{ active }}" bind:change="onChange" animated> <van-tab title="未送达"> <scroll-view scroll-y="true" style="height: 900rpx; margin-top: 45rpx;"> <view class="order_box" style="height: 400px;opacity: 0.85;margin-top:5%;margin-left:16%;margin-bottom: 5%;" wx:for="{{orderList}}" wx:key="oid"> <van-card desc="订单号:{{item.oid}}" title="{{item.oname}}" num="{{item.count}}" price="{{item.money}}" desc-class="cardDesc" style="margin-bottom: 5%;" > <view slot="footer"> <button class="box_btn" bindtap="showDetailDialog" size="mini">详情</button> <button class="box_btn" size="mini" bindtap="orderReminder">催单</button> </view> </van-card> </view> </scroll-view> </van-tab> <van-tab title="待支付" dot="true"> <scroll-view scroll-y="true" style="height: 400px;"> <view class="order_box" style="height: 400px;opacity: 0.85;margin-top:5%;margin-left:16%;"> <view style="margin-bottom: 5%;"> </view> </view> </scroll-view> </van-tab> <van-tab title="待评价" dot="true"> <scroll-view scroll-y="true" style="height: 400px;"> <view class="order_box" style="height: 400px;opacity: 0.85;margin-top:5%;margin-left:16%;"> <view style="margin-bottom: 5%;"> </view> </view> </scroll-view> </van-tab> </van-tabs> wxss代码: .van-tab{} .van-tabs{} .van-card{ width: 80%; height: 35%; border-radius:7px } .order_box{ justify-content: center; height: 20%; } .scroll-view{} .cardDesc{ margin-top: 20rpx; }
2022-03-10 - 如何将传入的数据分类写到不同的tab下?
tag是这样的,各个tag都有对应的属性值。我之前没接触过前端,不会写这个...... [图片] 用的是vant的组件: <van-tabs active="{{ active }}" bind:change="onChange" animated> <van-tab title="未送达">......</van-tab> <van-tab title="待支付">......</van-tab> <van-tab title="待评价">......</van-tab> </van-tabs>
2022-03-10 - 使用vant组件的商品卡片display时,如何实现删除功能?
就是有个删除按钮在卡片上,按的时候可以将其删除掉。
2022-03-08 - 请问这里vant里的field组件为啥不能正常使用?
直接打开的同学的项目,再同学的电脑里可以正常打开。报错是这样的: [图片] 相关代码是这样的: <van-cell-group inset class="input-container"> <van-field label="收件人" left-icon="user-o" value="{{ uname }}" size="large" focus="{{ true }}" placeholder="请输入收件人" border="{{ false }}" /> <van-field label="货物" left-icon="shopping-cart-o" value="{{ uname }}" size="large" focus="{{ true }}" placeholder="请输入货物名" border="{{ false }}" /> <van-field label="配送地" left-icon="location-o" value="{{ gaddress }}" size="large" focus="{{ true }}" placeholder="请输入配送地" border="{{ false }}" /> <van-field label="货物数量" left-icon="add-o" value="{{ uphonenumber }}" size="large" focus="{{ true }}" placeholder="请输入手机号" border="{{ false }}" /> <van-field label="货物重量" left-icon="bag-o" value="{{ uphonenumber }}" size="large" focus="{{ true }}" placeholder="请输入手机号" border="{{ false }}" /> <van-field label="货物重量" left-icon="bag-o" value="{{ uphonenumber }}" size="large" focus="{{ true }}" placeholder="请输入手机号" border="{{ false }}" /> <van-cell icon="fire-o" title="加急" value="{{money}}" title-width="200rpx"> <van-radio-group value="{{ radio }}" bind:change="onChange" direction="horizontal" disabled > <van-radio name="1" shape="square" label-position="left">是</van-radio> <van-radio name="0" shape="square" label-position="left">否</van-radio> </van-radio-group> </van-cell> <van-cell icon="flower-o" title="易碎" value="{{money}}" title-width="200rpx"> <van-radio-group value="{{ radio }}" bind:change="onChange" direction="horizontal" disabled > <van-radio name="1" shape="square" label-position="left">是</van-radio> <van-radio name="0" shape="square" label-position="left">否</van-radio> </van-radio-group> </van-cell> <van-field label="备注" left-icon="notes-o" value="{{ uphonenumber }}" size="large" focus="{{ true }}" placeholder="请输入手机号" border="{{ false }}" /> </van-cell-group> </view> </van-dialog> wxss也写了 .van_field{} 而且也按照了正确路径注册
2022-03-08 - 请问vant weapp弹出框组件里的按钮怎么调整?
出来是这样的:[图片] 相关代码: wxml: <button class="add_btn" bindtap="showDialog" style="margin-left: 20%; opacity: 0.50; filter: alpha(opacity=80);">添加订单</button> <van-dialog use-slot title="添加订单" show="{{ show }}" show-cancel-button confirm-button-open-type="getUserInfo" bind:close="onClose" bind:getuserinfo="getUserInfo" > </van-dialog> js: data: { show: false, value: 0, }, onChange(event) { this.setData({ value: event.detail, }); }, showDialog(){ this.setData({ show: true}); }, getUserInfo(event) { console.log(event.detail); }, onClose() { this.setData({ show: false }); },
2022-03-08 - vant weapp模板的tab功能无法正常使用?
使用tab之后,显示情况如图。不过内容可以正常切换。[图片] 相关代码: wxml: <view style="width: 100%;height: 100%;position: absolute; background-image: url(https://images.pexels.com/photos/6216361/pexels-photo-6216361.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940);background-size: 100% 100%;"> <van-tabs active="{{ active }}" bind:change="onChange"> <van-tab title="未送达">内容 1</van-tab> <van-tab title="待支付">内容 2</van-tab> <van-tab title="待评价">内容 3</van-tab> </van-tabs> </view> js: data: { active: 0, }, onChange(event) { wx.showToast({ title: `切换到 ${event.detail.title}`, icon: 'none', }); }, vant weapp给出的效果: [图片]
2022-03-07 - 这个关于渲染图片的报错是怎么回事?
而且报错显示的图片路径跟我写的图片路径不一致。[图片]
2022-03-07