diff --git a/.babelrc b/.babelrc index e027e954..fb53b482 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,6 @@ { "presets": [ - ["es2015"] - ] + ["env","stage-2"] + ], + "plugins": ["transform-runtime"] } diff --git a/example/main.js b/example/main.js index ef017787..10ca0547 100644 --- a/example/main.js +++ b/example/main.js @@ -49,6 +49,7 @@ import CheckList from './routers/checklist.vue'; import Search from './routers/search.vue'; import ScrollNav from './routers/scrollnav.vue'; import Preview from './routers/preview.vue'; +import PullRefresh from './routers/pullRefresh.vue'; import App from './app.vue'; @@ -107,6 +108,7 @@ const router = new VueRouter({ {path: '/search', name: 'search', component: Search}, {path: '/scrollnav', name: 'scrollnav', component: ScrollNav}, {path: '/preview', name: 'preview', component: Preview}, + {path: '/pullRefresh', name: 'pullRefresh', component: PullRefresh}, ] }); diff --git a/example/routers/index.vue b/example/routers/index.vue index 33f51222..fac056e4 100644 --- a/example/routers/index.vue +++ b/example/routers/index.vue @@ -52,6 +52,7 @@ {icon: 'demo-icons-scrollnav', name: 'ScrollNav', link: '/scrollnav'}, {icon: 'demo-icons-scrolltab', name: 'ScrollTab', link: '/scrolltab'}, {icon: 'demo-icons-preview', name: 'Preview', link: '/preview'}, + {icon: 'demo-icons-preview', name: 'PullRefresh', link: '/pullRefresh'}, ] } } diff --git a/example/routers/pullRefresh.vue b/example/routers/pullRefresh.vue new file mode 100644 index 00000000..41b44692 --- /dev/null +++ b/example/routers/pullRefresh.vue @@ -0,0 +1,134 @@ + + + diff --git a/package.json b/package.json index 9a9d5c3e..9fd6ac91 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,10 @@ "autoprefixer": "^6.6.1", "babel-core": "^6.21.0", "babel-loader": "^6.2.10", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-preset-env": "^1.7.0", "babel-preset-es2015": "^6.18.0", + "babel-preset-stage-2": "^6.24.1", "css-loader": "^0.26.1", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.10.1", diff --git a/src/components/pullrefresh/src/pullrefresh.vue b/src/components/pullrefresh/src/pullrefresh.vue index 1b7198b0..bf3facd2 100644 --- a/src/components/pullrefresh/src/pullrefresh.vue +++ b/src/components/pullrefresh/src/pullrefresh.vue @@ -218,9 +218,15 @@ this.resetParams(); }, - triggerLoad() { + async triggerLoad() { this.touches.loading = true; - this.callback && this.callback(); + var fn = this.callback&&this.callback(); + if(fn&&fn.then&&typeof fn.then =='function'){ + let ser = await fn; + if(ser){ + this.resetParams(); + } + } }, resetParams() { this.dragTip.translate = 0;