now you need something exactly the same as the bottom tabbar. All you need is to click on one, change its image and background color to the selected style, and the rest will default.
now that I"ve done it, I can do this, but the process is really ugly. The following code
HTML
<div class="optioncardbox">
<div class="optioncard optioncardtext" @click="changetype(0)">
<p :class="[is0?a:b]">ALL
<p class="optioncardtip">
</div>
<div class="optioncard optioncardlist">
<img :src="[is1?e:f]" alt="" srcset="" :class="[is1?d:c]" @click="changetype(1)">
<p class="optioncardtip">
</div>
<div class="optioncard optioncardlist">
<img :src="[is2?g:h]" alt="" srcset="" :class="[is2?d:c]" @click="changetype(2)">
<p class="optioncardtip">
</div>
<div class="optioncard optioncardlist">
<img :src="[is3?i:j]" alt="" srcset="" :class="[is3?d:c]" @click="changetype(3)">
<p class="optioncardtip">
</div>
<div class="optioncard optioncardlist">
<img :src="[is4?k:l]" alt="" srcset="" :class="[is4?d:c]" @click="changetype(4)">
<p class="optioncardtip">
</div>
<div class="optioncard optioncardlist">
<img :src="[is5?m:n]" alt="" srcset="" :class="[is5?d:c]" @click="changetype(5)">
<p class="optioncardtip">
</div>
</div>
JavaScript
export default {
data() {
return {
is0: true,
is1: false,
is2: false,
is3: false,
is4: false,
is5: false,
istip0: true,
istip1: false,
istip2: false,
goodsinfo: [],
targetid: 0,
a: "optioncardfirst",
b: "notoptioncardfirst",
c: "optioncardimg",
d: "notoptioncardimg",
e: "../../../static/image/icon16-y.png",
f: "../../../static/image/icon16.png",
g: "../../../static/image/icon17-y.png",
h: "../../../static/image/icon17.png",
i: "../../../static/image/icon18-y.png",
j: "../../../static/image/icon18.png",
k: "../../../static/image/icon19-y.png",
l: "../../../static/image/icon19.png",
m: "../../../static/image/icon20-y.png",
n: "../../../static/image/icon20.png",
o: "islessonlistoptioncard",
p: "lessonlistoptioncard",
}
},
methods: {
changetype(x) {
if (x == 0) {
this.is0 = true
this.is1 = false
this.is2 = false
this.is3 = false
this.is4 = false
this.is5 = false
this.targetid = 0
this.getLessonlist(0)
this.istip0 = true
this.istip1 = false
this.istip2 = false
} else if (x == 1) {
this.is1 = true
this.is0 = false
this.is2 = false
this.is3 = false
this.is4 = false
this.is5 = false
this.targetid = 16
this.getLessonlist(0)
this.istip0 = true
this.istip1 = false
this.istip2 = false
} else if (x == 2) {
this.istip0 = true
this.istip1 = false
this.istip2 = false
this.is2 = true
this.is0 = false
this.is1 = false
this.is3 = false
this.is4 = false
this.is5 = false
this.targetid = 17
this.getLessonlist(0)
} else if (x == 3) {
this.istip0 = true
this.istip1 = false
this.istip2 = false
this.is3 = true
this.is0 = false
this.is2 = false
this.is1 = false
this.is4 = false
this.is5 = false
this.targetid = 18
this.getLessonlist(0)
} else if (x == 4) {
this.istip0 = true
this.istip1 = false
this.istip2 = false
this.is4 = true
this.is0 = false
this.is2 = false
this.is3 = false
this.is1 = false
this.is5 = false
this.targetid = 19
this.getLessonlist(0)
} else if (x == 5) {
this.istip0 = true
this.istip1 = false
this.istip2 = false
this.is5 = true
this.is0 = false
this.is2 = false
this.is3 = false
this.is4 = false
this.is1 = false
this.targetid = 20
this.getLessonlist(0)
}
},
this is part of the code, and some of it doesn"t matter. The basic idea now is to load 2 sets of different styles and src, and then decide to switch after each click, load the selected ones, and return to the default values for the rest. But this kind of code is really tedious, and I feel that programmers should not write such code, which is really humiliating, who has a good idea to provide it. Thank you very much.