From b2bfb09752404c7c264ca6f6c5484aba0caada76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Mon, 4 Jun 2018 18:30:39 +0800 Subject: [PATCH] add Rate --- src/code/rate.js | 89 ++++++++++++++++++++++++++++ src/router.js | 7 +++ src/views/components/rate.vue | 108 ++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 src/code/rate.js create mode 100644 src/views/components/rate.vue diff --git a/src/code/rate.js b/src/code/rate.js new file mode 100644 index 0000000..ab50f70 --- /dev/null +++ b/src/code/rate.js @@ -0,0 +1,89 @@ +let code = {}; + +code.import = ` +"usingComponents": { + "i-rate": "../../dist/rate/index" +} +`; +code.usage = ` + + + + + + + + + + + + + + + + {{starIndex2}}星 + + + + + {{starIndex3}}星 + + + + + {{starIndex4}}星 + + + +`; + +code.js = ` +Page({ + data : { + starIndex1 : 0, + starIndex2 : 0, + starIndex3 : 0, + starIndex4 : 4, + starIndex5 : 5 + }, + onChange1(e){ + const index = e.detail.index; + this.setData({ + 'starIndex1' : index + }) + }, + onChange2(e){ + const index = e.detail.index; + this.setData({ + 'starIndex2' : index + }) + }, + onChange3(e){ + const index = e.detail.index; + this.setData({ + 'starIndex3' : index + }) + }, + onChange5(e){ + const index = e.detail.index; + this.setData({ + 'onChange5' : index + }) + } +}); +`; + +export default code; \ No newline at end of file diff --git a/src/router.js b/src/router.js index 8b7580c..fe434df 100755 --- a/src/router.js +++ b/src/router.js @@ -219,6 +219,13 @@ const routers = [ }, component: (resolve) => require(['./views/components/switch.vue'], resolve) }, + { + path: '/components/rate', + meta: { + title: '评分 Rate' + }, + component: (resolve) => require(['./views/components/rate.vue'], resolve) + }, { path: '*', redirect: '/' diff --git a/src/views/components/rate.vue b/src/views/components/rate.vue new file mode 100644 index 0000000..bf68810 --- /dev/null +++ b/src/views/components/rate.vue @@ -0,0 +1,108 @@ + + \ No newline at end of file