From 80bb619c8318208de56e4884d49cf1b6078e5009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Mon, 4 Jun 2018 14:25:29 +0800 Subject: [PATCH] add Page --- src/code/page.js | 65 ++++++++++++++++++++++ src/router.js | 7 +++ src/views/components/page.vue | 102 ++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 src/code/page.js create mode 100644 src/views/components/page.vue diff --git a/src/code/page.js b/src/code/page.js new file mode 100644 index 0000000..ca775b0 --- /dev/null +++ b/src/code/page.js @@ -0,0 +1,65 @@ +let code = {}; + +code.import = ` +"usingComponents": { + "i-page": "../../dist/page/index" +} +`; +code.usage = ` +带有文字的按钮 + + + Prev + Next + + +带有文字和图标的按钮 + + + + + 上一步 + + + 下一步 + + + + +隐藏数字 + + + Prev + Next + + +只显示数字 + + + +显示点 + + +`; + +code.js = ` +Page({ + data: { + current: 1 + }, + handleChange ({ detail }) { + const type = detail.type; + if (type === 'next') { + this.setData({ + current: this.data.current + 1 + }); + } else if (type === 'prev') { + this.setData({ + current: this.data.current - 1 + }); + } + } +}); +`; + +export default code; \ No newline at end of file diff --git a/src/router.js b/src/router.js index b0a6006..2a9093d 100755 --- a/src/router.js +++ b/src/router.js @@ -100,6 +100,13 @@ const routers = [ }, component: (resolve) => require(['./views/components/drawer.vue'], resolve) }, + { + path: '/components/page', + meta: { + title: '分页 Page' + }, + component: (resolve) => require(['./views/components/page.vue'], resolve) + }, { path: '*', redirect: '/' diff --git a/src/views/components/page.vue b/src/views/components/page.vue new file mode 100644 index 0000000..d422a62 --- /dev/null +++ b/src/views/components/page.vue @@ -0,0 +1,102 @@ + + \ No newline at end of file