This repository was archived by the owner on Mar 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +38
-17
lines changed
Expand file tree Collapse file tree 3 files changed +38
-17
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vue-impression" ,
3- "version" : " 0.13.11 " ,
3+ "version" : " 0.13.13 " ,
44 "description" : " A Vue.js 2.0 UI elements for mobile." ,
55 "main" : " dist/scripts/components/index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 193193 this .negative = false ;
194194 }
195195 },
196+ // 异步swipeItem
197+ length () {
198+ if (this .length ) {
199+ this .initDrag ();
200+ this .play ();
201+ }
202+ },
196203 },
197204 mounted () {
198205 this .init ();
199- this .initDrag ();
200- this .play ();
201206 },
202207 updated () {
208+ this .$nextTick (() => {
209+ this .init ();
210+ });
203211 setTimeout (() => {
204212 this .transitioning = false ;
205213 }, this .speed );
Original file line number Diff line number Diff line change 55 :onDragStart =" onDragStart"
66 :onDrag =" onDrag"
77 :onDragEnd =" onDragEnd" >
8- <swipe-item >
9- <div class =" page-swipe-item bg-primary" >1</div >
10- </swipe-item >
11- <swipe-item >
12- <div class =" page-swipe-item bg-secondary" >2</div >
13- </swipe-item >
14- <swipe-item >
15- <div class =" page-swipe-item bg-success" >3</div >
16- </swipe-item >
17- <swipe-item >
18- <div class =" page-swipe-item bg-warning" >4</div >
19- </swipe-item >
20- <swipe-item >
21- <div class =" page-swipe-item bg-danger" >5</div >
8+ <swipe-item v-for =" item in swipeItems" >
9+ <div class =" page-swipe-item" :class =" item.theme" >{{item.text}}</div >
2210 </swipe-item >
2311 </swipe >
2412 <group-title >defaultIndex=1</group-title >
6250
6351<script >
6452 export default {
53+ data () {
54+ return {
55+ swipeItems: [],
56+ };
57+ },
6558 methods: {
6659 onDragStart (index ) {
6760 this .$toast ({
7972 });
8073 },
8174 },
75+ mounted () {
76+ setTimeout (() => {
77+ this .swipeItems = [{
78+ text: 1 ,
79+ theme: ' bg-primary' ,
80+ }, {
81+ text: 2 ,
82+ theme: ' bg-secondary' ,
83+ }, {
84+ text: 3 ,
85+ theme: ' bg-success' ,
86+ }, {
87+ text: 4 ,
88+ theme: ' bg-warning' ,
89+ }, {
90+ text: 5 ,
91+ theme: ' bg-danger' ,
92+ }];
93+ }, 1000 );
94+ },
8295 };
8396 </script >
8497
You can’t perform that action at this time.
0 commit comments