小程序
小游戏
企业微信
微信支付
扫描小程序码分享
根据首页选择男或者女,让后续页面只出现关于男性或者女性的问题答案页面!!!这种一般用什么思路做
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
我就是以男女为条件,可是后续的页面:比如选择男,用splice做,连不该删的页面也删了
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
为什么不用if??
我就是用if判断语句做的,估计是方法错误
splice本身就不可用在这一块应该是
如果if之后显示。隐藏可以吗?,,而且为什么splice会是不可用
全局变量
能不能再稍微提示一下可以吗大佬,这种案例一般叫做什么案例,能否点拨一下
额,你的问题是不是没有描述清楚啊,splice是干什么?
我可以加你qq给你看下效果图吗?劳烦你提示一下可以吗
搞个代码片段吧
代码太长了,
// 单选
if (type == "select") {
list[current].select = 1;
list[current].cur = id;
// 选中的加状态, 其他的去状态
items.map((v,i) => {
if (i == index) {
v.select = true;
} else {
v.select = false;
}
});
// 后面没有题目就跳到下一次,有题目就不动
if (list.length == current + 1) {
this.nextQuestion();
// 多选
else if (type == "select_multi") {
// 选中
if (!select) {
// 每个选中都加状态
items[index].select = true;
// 取消选中
else {
items[index].select = false;
list[current].select = 0;
for (let i = 0; i < items.length; i++) {
if (items[i].select) {
continue;
// break;
//第十页数据清除
if (list[0].select == 1 && list[0].items[0].select == true) {
console.log("dddd")
for (let i=0;i<list.length;i++) {
if (list[i].id===8) {
list.splice(i,1);
i-=1;
//跳转下一题
if (list.length == current+1 ) {
// 设置答案
this.setData({
list,
})
},
选择了性别之后,,后面的题目根据男女去判断就行了!!
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
我就是以男女为条件,可是后续的页面:比如选择男,用splice做,连不该删的页面也删了
为什么不用if??
我就是用if判断语句做的,估计是方法错误
splice本身就不可用在这一块应该是
如果if之后显示。隐藏可以吗?,,而且为什么splice会是不可用
全局变量
能不能再稍微提示一下可以吗大佬,这种案例一般叫做什么案例,能否点拨一下
额,你的问题是不是没有描述清楚啊,splice是干什么?
我可以加你qq给你看下效果图吗?劳烦你提示一下可以吗
搞个代码片段吧
代码太长了,
// 单选
if (type == "select") {
list[current].select = 1;
list[current].cur = id;
// 选中的加状态, 其他的去状态
items.map((v,i) => {
if (i == index) {
v.select = true;
} else {
v.select = false;
}
});
// 后面没有题目就跳到下一次,有题目就不动
if (list.length == current + 1) {
this.nextQuestion();
}
}
// 多选
else if (type == "select_multi") {
// 选中
if (!select) {
// 每个选中都加状态
list[current].select = 1;
items[index].select = true;
}
// 取消选中
else {
items[index].select = false;
list[current].select = 0;
for (let i = 0; i < items.length; i++) {
if (items[i].select) {
list[current].select = 1;
continue;
// break;
}
}
}
}
//第十页数据清除
if (list[0].select == 1 && list[0].items[0].select == true) {
console.log("dddd")
for (let i=0;i<list.length;i++) {
if (list[i].id===8) {
list.splice(i,1);
i-=1;
}
}
//跳转下一题
if (list.length == current+1 ) {
this.nextQuestion();
}
}
// 设置答案
this.setData({
list,
})
},
})
},
选择了性别之后,,后面的题目根据男女去判断就行了!!