|
1 | 1 | <template> |
2 | 2 | <view |
3 | 3 | wx:class="{{ sliderClass }}" |
4 | | - wx:style="{{ { ...containerStyle, ...tabAreaStyle } }}" |
| 4 | + wx:style="{{ containerStyle }}" |
5 | 5 | > |
6 | 6 | <gesture |
| 7 | + wx:if="{{ __mpx_mode__ === 'android' || __mpx_mode__ === 'ios' || __mpx_mode__ === 'harmony' }}" |
7 | 8 | ontouchstart="{{startHandler}}" |
8 | 9 | ontouchmove="{{moveHandler}}" |
9 | 10 | ontonouchend="{{endHandler}}" |
|
35 | 36 | </view> |
36 | 37 | </view> |
37 | 38 | </gesture> |
| 39 | + <view |
| 40 | + wx:ref |
| 41 | + wx:else |
| 42 | + class="cube-slider-tab-area" |
| 43 | + wx:style="{{ tabAreaStyle }}" |
| 44 | + bind:tap="onClick" |
| 45 | + > |
| 46 | + <!-- 滑块儿容器 --> |
| 47 | + <view |
| 48 | + class="cube-slider-handle" |
| 49 | + wx:style="{{ handleStyle }}" |
| 50 | + capture-catch:touchstart="startHandler" |
| 51 | + capture-catch:touchmove="moveHandler" |
| 52 | + capture-catch:touchend="endHandler" |
| 53 | + > |
| 54 | + <!-- 滑块儿 --> |
| 55 | + <view class="cube-slider-thumb-custom" wx:style="{{ { display: customContent ? '' : 'none', ...thumbStyle } }}"> |
| 56 | + <!-- 自定义滑块儿 --> |
| 57 | + <slot></slot> |
| 58 | + </view> |
| 59 | + <view |
| 60 | + wx:if="{{!customContent}}" |
| 61 | + class="cube-slider-thumb" |
| 62 | + wx:style="{{ thumbStyle }}" |
| 63 | + ></view> |
| 64 | + </view> |
| 65 | + <view class="cube-slider-track" wx:style="{{ trackStyle }}"> |
| 66 | + <view class="cube-slider-step" wx:style="{{ stepStyle }}"></view> |
| 67 | + </view> |
| 68 | + </view> |
38 | 69 | <view wx:if="{{ showValueLable }}" class="cube-slider-value"> |
39 | 70 | <text |
40 | 71 | numberOfLines@_ios|_android|_harmony="{{1}}" |
|
54 | 85 | /* @mpx-endif */ |
55 | 86 | </style> |
56 | 87 |
|
57 | | -<script type="application/json"> |
58 | | - { |
| 88 | +<script name="json"> |
| 89 | + const isNative = __mpx_mode__ === 'ios' || __mpx_mode__ === 'android' || __mpx_mode__ === 'harmony' |
| 90 | + const base = { |
59 | 91 | "styleIsolation": "shared", |
60 | | - "component": true, |
61 | | - "usingComponents": { |
62 | | - "gesture": "./gesture.tsx" |
| 92 | + "component": true |
| 93 | + } |
| 94 | + if (isNative) { |
| 95 | + module.exports = { |
| 96 | + ...base, |
| 97 | + "usingComponents": { |
| 98 | + "gesture": "./gesture.tsx" |
| 99 | + } |
63 | 100 | } |
| 101 | + } else { |
| 102 | + module.exports = base |
64 | 103 | } |
65 | 104 | </script> |
0 commit comments