diff --git a/example/components/demo-home-nav/index.js b/example/components/demo-home-nav/index.js new file mode 100644 index 00000000..07508d5f --- /dev/null +++ b/example/components/demo-home-nav/index.js @@ -0,0 +1,13 @@ +Component({ + properties: { + group: Object + }, + + methods: { + onClick(event) { + wx.navigateTo({ + url: event.target.dataset.url + }); + } + } +}); diff --git a/example/components/demo-home-nav/index.json b/example/components/demo-home-nav/index.json new file mode 100644 index 00000000..c175daca --- /dev/null +++ b/example/components/demo-home-nav/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../../dist/icon" + } +} diff --git a/example/components/demo-home-nav/index.wxml b/example/components/demo-home-nav/index.wxml new file mode 100644 index 00000000..1d7a84cf --- /dev/null +++ b/example/components/demo-home-nav/index.wxml @@ -0,0 +1,15 @@ + + {{ group.groupName }} + + + {{ item.title }} + + + + diff --git a/example/components/demo-home-nav/index.wxss b/example/components/demo-home-nav/index.wxss new file mode 100644 index 00000000..691c6403 --- /dev/null +++ b/example/components/demo-home-nav/index.wxss @@ -0,0 +1,38 @@ +.demo-home-nav__title { + margin: 24px 0 8px 16px; + color: rgba(69, 90, 100, 0.6); + font-size: 14px; +} + +.demo-home-nav__block { + position: relative; + display: flex; + margin: 0 0 12px; + padding-left: 20px; + color: #323233; + font-weight: 500; + font-size: 14px; + line-height: 40px; + background: #f7f8fa; + border-radius: 99px; + transition: background 0.3s; +} + +.demo-home-nav__block:hover { + background: darken(#f7f8fa, 3%); +} + +.demo-home-nav__block:active { + background: darken(#f7f8fa, 6%); +} + +.demo-home-nav__icon { + position: absolute; + top: 50%; + right: 16px; + width: 16px; + height: 16px; + margin-top: -8px; + color: rgb(182, 195, 210); + font-weight: 900; +} diff --git a/example/components/demo-home/index.js b/example/components/demo-home/index.js new file mode 100644 index 00000000..aa1f017d --- /dev/null +++ b/example/components/demo-home/index.js @@ -0,0 +1,7 @@ +import list from '../../config'; + +Component({ + data: { + list, + }, +}); diff --git a/example/components/demo-home/index.json b/example/components/demo-home/index.json new file mode 100644 index 00000000..0b479242 --- /dev/null +++ b/example/components/demo-home/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "demo-home-nav": "../demo-home-nav" + } +} diff --git a/example/components/demo-home/index.wxml b/example/components/demo-home/index.wxml new file mode 100644 index 00000000..a9b97719 --- /dev/null +++ b/example/components/demo-home/index.wxml @@ -0,0 +1,18 @@ + + + + Vant Weapp + + + 轻量、可靠的小程序 UI 组件库 + + + + + diff --git a/example/components/demo-home/index.wxss b/example/components/demo-home/index.wxss new file mode 100644 index 00000000..056fc356 --- /dev/null +++ b/example/components/demo-home/index.wxss @@ -0,0 +1,46 @@ +.demo-home { + box-sizing: border-box; + width: 100%; + min-height: 100vh; + padding: 46px 20px 20px; + background: #fff; +} + +.demo-home__title, +.demo-home__desc { + padding-left: 16px; + font-weight: normal; + line-height: 1; + user-select: none; +} + +.demo-home__title { + margin: 0 0 16px; + font-size: 32px; +} + +.demo-home__image, +.demo-home__text { + display: inline-block; + vertical-align: middle; +} + +.demo-home__image { + width: 32px; + height: 32px; +} + +.demo-home__text { + margin-left: 16px; + font-weight: 500; +} + +.demo-home__title .demo-home--small { + font-size: 24px; +} + +.demo-home__desc { + margin: 0 0 40px; + color: rgba(69, 90, 100, 0.6); + font-size: 14px; +} diff --git a/example/pages/dashboard/index.js b/example/pages/dashboard/index.js index 4feaa9f8..b48a761e 100644 --- a/example/pages/dashboard/index.js +++ b/example/pages/dashboard/index.js @@ -3,20 +3,6 @@ import Page from '../../common/page'; Page({ data: { - list, - activeName: [] + list }, - - onChangeCollapse(event) { - this.setData({ - activeNames: event.detail - }); - }, - - onClick(event) { - const { switchTab, url } = event.currentTarget.dataset; - if (switchTab) { - wx.switchTab({ url }); - } - } }); diff --git a/example/pages/dashboard/index.json b/example/pages/dashboard/index.json index 2191dad7..f377e714 100644 --- a/example/pages/dashboard/index.json +++ b/example/pages/dashboard/index.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "Vant Weapp" + "navigationBarTitleText": "Vant Weapp", + "usingComponents": { + "demo-home": "../../components/demo-home" + } } diff --git a/example/pages/dashboard/index.wxml b/example/pages/dashboard/index.wxml index 33e6c42b..c07a5491 100644 --- a/example/pages/dashboard/index.wxml +++ b/example/pages/dashboard/index.wxml @@ -1,42 +1 @@ - - - - Vant Weapp - - 轻量、可靠的小程序 UI 组件库 - - - - - - - - + diff --git a/example/pages/dashboard/index.wxss b/example/pages/dashboard/index.wxss index 22505315..e69de29b 100644 --- a/example/pages/dashboard/index.wxss +++ b/example/pages/dashboard/index.wxss @@ -1,61 +0,0 @@ -page { - padding-bottom: 0; -} - -.container { - padding: 45px 20px 20px; -} - -.title { - padding-left: 15px; - margin-bottom: 10px; -} - -.logo, -.title-text { - display: inline-block; - vertical-align: middle; -} - -.title-text { - font-size: 32px; - font-weight: 500; - margin-left: 15px; -} - -.logo { - width: 36px; - height: 36px; -} - -.desc { - font-size: 14px; - color: #7d7e80; - margin: 0 0 45px; - padding-left: 15px; -} - -.mobile-nav { - margin-bottom: 16px; -} - -.mobile-nav__title { - font-size: 16px; - font-weight: 500; - line-height: 40px; - align-items: center; - border-radius: 2px; -} - -.mobile-nav__content { - padding: 0 !important; -} - -.mobile-nav__icon { - font-size: 24px !important; - margin-top: 8px; -} - -.mobile-nav__icon image { - width: 100%; -} diff --git a/example/project.config.json b/example/project.config.json index 303f0f39..376977d9 100644 --- a/example/project.config.json +++ b/example/project.config.json @@ -13,7 +13,7 @@ }, "compileType": "miniprogram", "cloudfunctionRoot": "functions/", - "libVersion": "2.8.2", + "libVersion": "2.3.0", "appid": "wx1c01b35002d3ba14", "projectname": "vant-weapp", "debugOptions": {