From e0d5ae30f35a930f22ace6cac169708c22479b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Mon, 4 Jun 2018 17:38:05 +0800 Subject: [PATCH] add Progress --- src/code/progress.js | 50 ++++++++++++++++++ src/router.js | 7 +++ src/views/components/progress.vue | 85 +++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 src/code/progress.js create mode 100644 src/views/components/progress.vue diff --git a/src/code/progress.js b/src/code/progress.js new file mode 100644 index 0000000..18037e7 --- /dev/null +++ b/src/code/progress.js @@ -0,0 +1,50 @@ +let code = {}; + +code.import = ` +"usingComponents": { + "i-progress": "../../dist/progress/index" +} +`; +code.usage = ` + + + + + + + + + + 增加 + 减少 + +`; + +code.js = ` +Page({ + data: { + percent: 0, + status: 'normal' + }, + handleAdd () { + if (this.data.percent === 100) return; + this.setData({ + percent: this.data.percent + 10 + }); + if (this.data.percent === 100) { + this.setData({ + status: 'success' + }); + } + }, + handleReduce () { + if (this.data.percent === 0) return; + this.setData({ + percent: this.data.percent - 10, + status: 'normal' + }); + } +}); +`; + +export default code; \ No newline at end of file diff --git a/src/router.js b/src/router.js index c962635..3528390 100755 --- a/src/router.js +++ b/src/router.js @@ -177,6 +177,13 @@ const routers = [ }, component: (resolve) => require(['./views/components/tag.vue'], resolve) }, + { + path: '/components/progress', + meta: { + title: '进度条 Progress' + }, + component: (resolve) => require(['./views/components/progress.vue'], resolve) + }, { path: '*', redirect: '/' diff --git a/src/views/components/progress.vue b/src/views/components/progress.vue new file mode 100644 index 0000000..89ec347 --- /dev/null +++ b/src/views/components/progress.vue @@ -0,0 +1,85 @@ + + \ No newline at end of file