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