我在uniapp上开发,运行到微信小程序时报错 Bad attr `data-event-opts` with message,求大神指点
原代码:
<view class="cu-form-group " v-for="(item, index) in mes.dataList" :key="item.id" v-if="item.type != 'dataList2'">
<view class="title"><text class="text-red" v-if="item.yz.length != 0">*</text>{{item.title}}</view>
<!-- 输入框 -->
<input :placeholder="item.placeholder" v-if="item.type === 'input'" v-model='item.value'></input>
<!-- 多选框 -->
<radio-group class="flex" @change="RadioChange(...arguments, index)" v-if="item.type === 'radio'">
<view class="cu-form-group padding-none" v-for="(items, indexs) in item.radio">
<radio color="#39B54A" :class="items.gender=='items.gender'?'checked' : ' ' " :checked="items.checked==true?true:false" :value="items.gender"></radio>
<view class="">{{items.gender}}</view>
</view>
</radio-group>
<!-- 出生年月 -->
<picker mode="date" :value="item.date" start="1900-01-01" end="2010-12-31"
@change="DateChange(...arguments, index)" v-if="item.type === 'date'">
<view class="picker">
{{item.date}}
</view>
</picker>
<!-- 学历 -->
<picker @change="PickerChange(...arguments, index)" :value='item.index' :range="item.picker"
v-if="item.type === 'select'">
<view class="picker">
{{item.index>-1?item.picker[item.index]:item.placeholder}}
</view>
</picker>
</view>
微信小程序报错内容:
Bad attr `data-event-opts` with message
<view class="cu-form-group "><view class="title"><block wx:if="{{item.yz.length!=0}}"><text class="text-red">*</text></block>{{item.title}}</view><block wx:if="{{item.type==='input'}}"><input placeholder="{{item.placeholder}}" data-event-opts="{{[['input',[['__set_model',['$0','value','$event',[]],[[['mes.dataList','id',item.id]]]]]]]}}" value="{{item.value}}" bindinput="__e"/></block><block wx:if="{{item.type==='radio'}}"><radio-group data-event-opts="{{[['change',[['RadioChange',[...arguments,index]]]]]}}" class="flex" bindchange="__e"><block wx:for="{{item.radio}}" wx:for-item="items" wx:for-index="indexs"><view class="cu-form-group padding-none"><radio class="{{[items.gender=='items.gender'?'checked':'']}}" color="#39B54A" checked="{{items.checked==true?true:false}}" value="{{items.gender}}"></radio><view>{{items.gender}}</view></view></block></radio-group></block><block wx:if="{{item.type==='date'}}"><picker mode="date" value="{{item.date}}" start="1900-01-01" end="2010-12-31" data-event-opts="{{[['change',[['DateChange',[...arguments,index]]]]]}}" bindchange="__e"><view class="picker">{{''+item.date+''}}</view></picker></block><block wx:if="{{item.type==='select'}}"><picker value="{{item.index}}" range="{{item.picker}}" data-event-opts="{{[['change',[['PickerChange',[...arguments,index]]]]]}}" bindchange="__e"><view class="picker">{{''+(item.index>-1?item.picker[item.index]:item.placeholder)+''}}</view></picker></block></view></block></block>
for 循环里的 <input> 不要使用 “v-model”,用 “:value” + “@blur” 的组合实现试试。
<!-- <input v-model="item.value" /> --> <input :value="item.value" @blur="item.value=$event.detail.value" />
怀疑是你的三元运算符的问题,建议不使用三元运算符。
有大佬解决这个问题了嘛?搞了两天了,要奔溃了
我也是这样,要奔溃了
楼主这个问题有解决吗?我也有遇到一样的问题