顶部选项卡角色传递后台如何解决?

weixin_37991204 2018-08-15 02:37:01

顶部页签选项卡的角色“老师”“学生”如何把这两个角色字段传递到后台呢?
我的代码: <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没定义。。。不知如何解决。
...全文
149 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_37991204 2018-08-17
  • 打赏
  • 举报
回复
有没有大佬帮忙解决下啊
weixin_37991204 2018-08-17
  • 打赏
  • 举报
回复
不行啊,数据库表还是空的。。。。
cv521zw 2018-08-17
  • 打赏
  • 举报
回复
switchNav: function (e) {
var page = this;
var index = e.target.dataset.current;
if (this.data.currentTab == index) {
return false;
} else {
page.setData({ currentTab: index });
}
},
你这段代码index 不就代表角色吗 把他传到后台不就完事了?

3,143

社区成员

发帖
与我相关
我的任务
社区描述
微信开发即微信公众平台开发,将企业信息、服务、活动等内容通过微信网页的方式进行表现,通过二次开发可以将公众账号由一个媒体型营销工具转化成提供服务的产品。
社区管理员
  • 微信开发
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧