mpvue-vant
mpvue-vant copied to clipboard
DatetimePicker组件其中有个属性formatter需要传个function,在methods中定义无效
请问该问题解决了吗?能否提供复现路径呢?
<!-- 日期选择 -->
<van-popup :show="timeShow" position="bottom" @close="timeShow=false">
<van-datetime-picker :value="date" show-toolbar title="请选择日期"
@confirm="onPick" @cancel="timeShow=false" @formatter="formatter"/>
</van-popup>
methods中定义了formatter的方法,渲染的时候直接就报找不到formatter fucntion
:formatter="formatter" 然后写在data里面虽然报错但是可以用
data() {
return {
formatter(type, value) {
if (type === 'year') {
return ${value}年
;
} else if (type === 'month') {
return ${value}月
;
} else if (type === 'day') {
return ${value}日
;
} else if (type === 'hour') {
return ${value}时
;
} else if (type === 'minute') {
return ${value}分
;
}
},
.....
checkbox 搭配单元格组件使用
<van-checkbox-group value="{{ result }}" bind:change="onChange"> <van-cell-group > <van-cell wx:for="{{ list }}" wx:key="index" title="复选框 {{ item }}" value-class="value-class" clickable data-index="{{ index }}" bind:click="toggle" > <van-checkbox catch:tap="noop" class="checkboxes-{{ index }}" name="{{ item }}" /> </van-cell> </van-cell-group> </van-checkbox-group>
class="checkboxes-{{ index }} 这个在mpvue 怎么写呀 @jy05568536 @Rychou