激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

node.js|vue.js|jquery|angularjs|React|json|js教程|

服務(wù)器之家 - 編程語言 - JavaScript - js教程 - 小程序?qū)崿F(xiàn)商品屬性選擇或規(guī)格選擇

小程序?qū)崿F(xiàn)商品屬性選擇或規(guī)格選擇

2022-02-17 19:26紙上畫佳人 js教程

這篇文章主要為大家詳細介紹了小程序?qū)崿F(xiàn)商品屬性選擇或規(guī)格選擇,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了小程序?qū)崿F(xiàn)商品屬性選擇或規(guī)格選擇的具體代碼,供大家參考,具體內(nèi)容如下

實現(xiàn)效果

小程序?qū)崿F(xiàn)商品屬性選擇或規(guī)格選擇

1.wxml

?
1
2
3
4
5
6
7
8
9
10
<view wx:for="{{list}}" wx:key="index" wx:key="index" wx:for-index="childIndex" style="margin: 40px 0">
  <view>{{item.name}}</view>
 
 
  <view class="s" wx:for="{{item.option_value}}" wx:key="index" >
   <text class="{{indexArr[childIndex] == index ? 'active':''}}" bindtap="choice" data-fid="{{childIndex}}" data-id="{{index}}">
    {{item.name}}
   </text>
  </view>
</view>

2.js

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
data: {
 //數(shù)據(jù)
  list: [
   {
    "goods_option_id": 1737,
    "option_id": 1737,
    "name": "冰度",
    "option_value": [
     {
      "goods_option_value_id": 3606,
      "option_value_id": 3606,
      "name": "正常冰",
      "image": "xxxxxx.png"
     },
     {
      "goods_option_value_id": 3605,
      "option_value_id": 3605,
      "name": "少冰",
      "image": "xxxxxx.png"
     },
     {
      "goods_option_value_id": 3604,
      "option_value_id": 3604,
      "name": "熱飲",
      "image": "xxxxxx.png"
     }
    ]
   },
   {
    "goods_option_id": 1738,
    "option_id": 1738,
    "name": "糖度",
    "option_value": [
     {
      "goods_option_value_id": 3608,
      "option_value_id": 3608,
      "name": "正常糖",
      "image": "xxxxxx.png"
     },
     {
      "goods_option_value_id": 3607,
      "option_value_id": 3607,
      "name": "少糖",
      "image": "xxxxxx.png"
     }
    ]
   },
   {
    "goods_option_id": 1737,
    "option_id": 1737,
    "name": "冰度",
    "option_value": [
     {
      "goods_option_value_id": 3606,
      "option_value_id": 3606,
      "name": "正常冰",
      "image": "xxxxxx.png"
     },
     {
      "goods_option_value_id": 3605,
      "option_value_id": 3605,
      "name": "少冰",
      "image": "xxxxxx.png"
     },
     {
      "goods_option_value_id": 3604,
      "option_value_id": 3604,
      "name": "熱飲",
      "image": "xxxxxx.png"
     }
    ]
   }
  ],
  arr: [],
  indexArr: []
 },
 
choice(e) {
  const fid = e.currentTarget.dataset.fid;
   const id = e.currentTarget.dataset.id;
  const arr = this.data.arr,
     arr2 = this.data.indexArr;
    
   arr[fid] = this.data.list[fid].option_value[id].name;
  arr2[fid] = id;
 
  this.setData({
   arr: arr,
   indexArr: arr2
  })
 },
 
 onLoad: function (options) {
  const res = this.data.indexArr;
  this.data.list.forEach((e,i) => {
   res[i] = 0;
   this.setData({
    indexArr: res
   })
  });
 }

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://blog.csdn.net/weixin_45121448/article/details/114691526

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 免费一级毛片在线播放视频老 | 最新日本中文字幕在线观看 | 国产羞羞视频在线观看免费应用 | 97伦理| 一级毛片在线免费观看 | 日本aaaa片毛片免费观蜜桃 | 久色乳综合思思在线视频 | 久久久成人一区二区免费影院 | 奇米影视8888狠狠狠狠 | 欧美一级全黄 | 模特三级在线观看 | 九九热在线精品视频 | 免费的性爱视频 | 一区二区精品视频 | 免费中文视频 | 精品在线一区二区三区 | 黄色片免费在线播放 | xxxx69hd一hd72| 一级毛片免费在线 | 日韩av在线网 | 国产精品视频自拍 | 伊人一二三四区 | 国产精品毛片无码 | 欧美a区| 黄网站在线免费看 | 午夜视频久久 | 国产在线精品一区二区三区 | 欧美日韩在线视频一区 | 国产一区二区三区在线免费观看 | 欧美黑人xx| 男男啪羞羞视频网站 | 国产精品免费一区二区三区在线观看 | 色交视频 | 色屁屁xxxxⅹ在线视频 | av色哟哟| 性aaa| 久久久国产精品视频 | 久久国产免费视频 | 亚洲精品v天堂中文字幕 | 亚洲精品午夜电影 | 成人一区二区在线观看视频 |