顶部页签选项卡的角色“老师”“学生”如何把这两个角色字段传递到后台呢?
我的代码: <view class="{{currentTab==0?'select':'default'}}" data-current="0" bindtap="switchNav">老师</view>
<view class="{{currentTab==1?'select':'default'}}" data-current="1" bindtap="switchNav">学生</view>
</view>
<view class="hr"></view>
<swiper name="orderjiaose" current="{{currentTab}}" array_jiaose="{{jiaose}}" bindchange="swiperTab" style="height:500px;">
JS:page({
data:{array_jiaose:[
{current:'0',jiaose:'老师'},
{ current: '1', jiaose:'学生' },
],
currentTab: 0,
},
swiperTab: function (e) {
console.log(
'滑块发生改变事件,携带值current值为;', e.detail.current
)
var that = this;
that.setData({ currentTab: e.detail.current });
},
switchNav: function (e) {
var page = this;
var index = e.target.dataset.current;
if (this.data.currentTab == index) {
return false;
} else {
page.setData({ currentTab: index });
}
},
//表单提交
formSubmit: function (e) {var orderjiaose=e.detail.current.orderjiaose
}
})
然后报错说orderjiaose没定义。。。不知如何解决。