File tree Expand file tree Collapse file tree
components/uni-swipe-action Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11export default {
2- data ( ) {
2+ data ( ) {
33 return {
44 position : [ ] ,
55 button : [ ]
66 }
77 } ,
88 computed : {
9- pos ( ) {
9+ pos ( ) {
1010 return JSON . stringify ( this . position )
1111 } ,
12- btn ( ) {
12+ btn ( ) {
1313 return JSON . stringify ( this . button )
1414 }
1515 } ,
1616 watch : {
17- show ( newVal ) {
17+ show ( newVal ) {
1818 if ( this . autoClose ) return
1919 let valueObj = this . position [ 0 ]
20+ if ( ! valueObj ) {
21+ valueObj = [ ]
22+ }
2023 valueObj . show = newVal
2124 this . $set ( this . position , 0 , valueObj )
2225 }
2326 } ,
2427 // #ifdef H5
25- mounted ( ) {
28+ mounted ( ) {
2629 this . init ( )
2730 this . getSize ( )
2831 this . getBUttonSize ( )
2932 } ,
3033 // #endif
3134 // #ifndef H5
32- onReady ( ) {
35+ onReady ( ) {
3336 this . init ( )
3437 this . getSize ( )
3538 this . getBUttonSize ( )
3639 } ,
3740 // #endif
3841 methods : {
39- init ( ) {
42+ init ( ) {
4043 uni . $on ( '__uni__swipe__event' , ( res ) => {
4144 if ( res !== this && this . autoClose ) {
4245 let valueObj = this . position [ 0 ]
@@ -45,23 +48,23 @@ export default {
4548 }
4649 } )
4750 } ,
48- openSwipe ( ) {
51+ openSwipe ( ) {
4952 uni . $emit ( '__uni__swipe__event' , this )
5053 } ,
51- change ( e ) {
54+ change ( e ) {
5255 this . $emit ( 'change' , e . open )
5356 let valueObj = this . position [ 0 ]
5457 valueObj . show = e . open
5558 this . $set ( this . position , 0 , valueObj )
5659 // console.log('改变', e);
5760 } ,
58- onClick ( index , item ) {
61+ onClick ( index , item ) {
5962 this . $emit ( 'click' , {
6063 content : item ,
6164 index
6265 } )
6366 } ,
64- getSize ( ) {
67+ getSize ( ) {
6568 const views = uni . createSelectorQuery ( ) . in ( this )
6669 views
6770 . selectAll ( '.selector-query-hock' )
@@ -75,7 +78,7 @@ export default {
7578 } )
7679 . exec ( )
7780 } ,
78- getBUttonSize ( ) {
81+ getBUttonSize ( ) {
7982 const views = uni . createSelectorQuery ( ) . in ( this )
8083 views
8184 . selectAll ( '.button-hock' )
You can’t perform that action at this time.
0 commit comments