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