File tree Expand file tree Collapse file tree 7 files changed +15
-9
lines changed
packages/mpx-cube-ui/src/components/slider Expand file tree Collapse file tree 7 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1616
1717 createPage({
1818 data: {
19- currentValue: false
19+ currentValue: 0
2020 },
2121 methods: {
2222 handleChange(e) {
Original file line number Diff line number Diff line change 1212
1313 createComponent({
1414 data: {
15- currentValue: false
15+ currentValue: 0
1616 },
1717 methods: {
1818 handleChange(e) {
Original file line number Diff line number Diff line change 1515
1616 createComponent({
1717 data: {
18- currentValue: false
18+ currentValue: 0
1919 },
2020 methods: {
2121 handleChange(e) {
Original file line number Diff line number Diff line change 1515
1616 createComponent({
1717 data: {
18- currentValue: false
18+ currentValue: 0
1919 },
2020 methods: {
2121 handleChange(e) {
Original file line number Diff line number Diff line change 1313
1414 createComponent({
1515 data: {
16- currentValue: false
16+ currentValue: 0
1717 },
1818 methods: {
1919 handleChange(e) {
Original file line number Diff line number Diff line change 1313
1414 createComponent({
1515 data: {
16- currentValue: false
16+ currentValue: 0
1717 },
1818 methods: {
1919 handleChange(e) {
Original file line number Diff line number Diff line change 1+ import { MOUNTED } from '@mpxjs/core'
12import { createComponent } from '../../common/helper/create-component'
23
34const EVENT_CHANGE = 'change' // 完成一次拖动后触发的事件
@@ -117,6 +118,11 @@ createComponent({
117118 immediate : true
118119 }
119120 } ,
121+ [ MOUNTED ] ( ) {
122+ this . getRect ( ) . then ( res => {
123+ this . startDragRect = res
124+ } )
125+ } ,
120126 computed : {
121127 sliderClass ( ) {
122128 return {
@@ -183,7 +189,7 @@ createComponent({
183189 }
184190 } ,
185191 methods : {
186- getOffsetX ( ) {
192+ getRect ( ) {
187193 return new Promise ( ( resolve ) => {
188194 this . createSelectorQuery ( )
189195 . select ( '.cube-slider-tab-area' )
@@ -212,17 +218,17 @@ createComponent({
212218 }
213219 } ,
214220 async onClick ( e ) {
215- const rect = await this . getOffsetX ( )
221+ const rect = await this . getRect ( )
216222 this . calcProgress ( e . detail . x , rect )
217223 // 完成一次拖动后触发的事件
218224 // @arg event.detail = {value}
219225 this . triggerEvent ( EVENT_CHANGE , { value : this . currentValue } )
220226 } ,
221227 async startHandler ( e ) {
222- this . startDragRect = await this . getOffsetX ( )
223228 if ( __mpx_mode__ === 'web' ) {
224229 e && e . preventDefault ( )
225230 }
231+ this . startDragRect = await this . getRect ( )
226232 } ,
227233 moveHandler ( e ) {
228234 if ( ! this . startDragRect ) {
You can’t perform that action at this time.
0 commit comments