Commit f332295ba5592f3c1781fd72266d99b6c5a7e882
1 parent
409528ec
自定义卡项模版修改
Showing
3 changed files
with
39 additions
and
6 deletions
components/diy_serviceCard/diy_serviceCard.js
| ... | ... | @@ -55,6 +55,7 @@ Component({ |
| 55 | 55 | |
| 56 | 56 | lifetimes: { |
| 57 | 57 | attached: function() { |
| 58 | + let myStyle = ''; | |
| 58 | 59 | //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 |
| 59 | 60 | var nav_item = this.data.object; |
| 60 | 61 | var nav_list = this.data.object.nav_list; |
| ... | ... | @@ -102,12 +103,40 @@ Component({ |
| 102 | 103 | if (this.data.object.goodsnum) hei += 80; |
| 103 | 104 | |
| 104 | 105 | if (this.data.object.title_color) { |
| 105 | - this.data.title_class = `color:${this.data.object.title_color};` | |
| 106 | + // this.data.title_class = `color:${this.data.object.title_color};` | |
| 106 | 107 | } |
| 107 | 108 | |
| 108 | - if (this.data.object.title_font_size) { | |
| 109 | - this.data.title_class = this.data.title_class.concat(`font-size:${this.data.object.title_font_size}px;`) | |
| 109 | + if (this.data.object.font_size) { | |
| 110 | + this.data.title_class = this.data.title_class.concat(`font-size:${this.data.object.font_size}px;`); | |
| 110 | 111 | } |
| 112 | + | |
| 113 | + if (this.data.object.font_color) { | |
| 114 | + this.data.title_class = this.data.title_class.concat(`color:${this.data.object.font_color};`); | |
| 115 | + } | |
| 116 | + | |
| 117 | + if (this.data.object.acitve_font_color) { | |
| 118 | + this.setData({ | |
| 119 | + myStyle: ` | |
| 120 | + --border-color:${this.data.object.acitve_font_color}; | |
| 121 | + --font-color:${this.data.object.acitve_font_color}; | |
| 122 | + `, | |
| 123 | + }); | |
| 124 | + } | |
| 125 | + | |
| 126 | + if (this.data.object.list_border_type == 0) { | |
| 127 | + this.data.title_class = this.data.title_class.concat('border-radius: 80rpx;'); | |
| 128 | + } | |
| 129 | + | |
| 130 | + if (this.data.object.list_border_type == 1) { | |
| 131 | + this.data.title_class = this.data.title_class.concat('border-radius: 0;'); | |
| 132 | + } | |
| 133 | + | |
| 134 | + if (this.data.object.list_border_type == 2) { | |
| 135 | + this.data.title_class = this.data.title_class.concat('border-width: 0;'); | |
| 136 | + } | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 111 | 140 | this.setData({ |
| 112 | 141 | swiper_hei: hei, |
| 113 | 142 | title_class: this.data.title_class, | ... | ... |
components/diy_serviceCard/diy_serviceCard.wxml
| ... | ... | @@ -12,8 +12,9 @@ |
| 12 | 12 | </block> --> |
| 13 | 13 | |
| 14 | 14 | <!-- 服务卡项顶部标题 --> |
| 15 | +<!-- class="scroll-view-item {{index == title_index ? 'active':''}}" --> | |
| 15 | 16 | <scroll-view scroll-x="true" enhanced="true" fast-deceleration="true" show-scrollbar="false" wx:if="{{is_nav}}"> |
| 16 | - <view class="flex fs28"> | |
| 17 | + <view class="flex" style="{{myStyle}}"> | |
| 17 | 18 | <view |
| 18 | 19 | wx:for="{{nav_list}}" |
| 19 | 20 | data-index="{{index}}" | ... | ... |
components/diy_serviceCard/diy_serviceCard.wxss
| 1 | 1 | /* pages/diy_zs/diy_zs.wxss */ |
| 2 | +:root { | |
| 3 | + | |
| 4 | +} | |
| 2 | 5 | |
| 3 | 6 | .zwp_3 { |
| 4 | 7 | margin-top: 10rpx; |
| ... | ... | @@ -920,8 +923,8 @@ top: 10rpx; |
| 920 | 923 | } |
| 921 | 924 | |
| 922 | 925 | .scroll-view-item.active { |
| 923 | - color: #f2270c; | |
| 924 | - border-color: #f2270c !important; | |
| 926 | + color: var(--font-color) !important; | |
| 927 | + border-color: var(--border-color) !important; | |
| 925 | 928 | } |
| 926 | 929 | |
| 927 | 930 | ... | ... |