From 6927efce646ce293ed079496852653db74d0d461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 30 Jul 2018 20:36:42 +0800 Subject: [PATCH] [breaking change] Noticebar: rename to NoticeBar --- changelog.md | 6 ++--- dist/noticebar/index.js | 4 ++-- dist/noticebar/index.wxml | 12 +++++----- dist/noticebar/index.wxss | 2 +- doc.config.js | 2 +- example/app.json | 2 +- example/pages/dashboard/config.js | 4 ++-- example/pages/helper/index.js | 12 +--------- .../pages/{noticebar => notice-bar}/index.js | 2 +- example/pages/notice-bar/index.json | 7 ++++++ .../{noticebar => notice-bar}/index.wxml | 14 ++++++------ example/pages/noticebar/index.json | 7 ------ packages/helper/common/clearfix.pcss | 2 +- packages/{noticebar => notice-bar}/README.md | 22 +++++++++---------- packages/{noticebar => notice-bar}/index.js | 6 ++--- packages/{noticebar => notice-bar}/index.json | 0 packages/{noticebar => notice-bar}/index.pcss | 2 +- packages/{noticebar => notice-bar}/index.wxml | 14 ++++++------ 18 files changed, 55 insertions(+), 65 deletions(-) rename example/pages/{noticebar => notice-bar}/index.js (99%) create mode 100644 example/pages/notice-bar/index.json rename example/pages/{noticebar => notice-bar}/index.wxml (87%) delete mode 100644 example/pages/noticebar/index.json rename packages/{noticebar => notice-bar}/README.md (82%) rename packages/{noticebar => notice-bar}/index.js (96%) rename packages/{noticebar => notice-bar}/index.json (100%) rename packages/{noticebar => notice-bar}/index.pcss (97%) rename packages/{noticebar => notice-bar}/index.wxml (53%) diff --git a/changelog.md b/changelog.md index e650d19f..31a3ab24 100644 --- a/changelog.md +++ b/changelog.md @@ -71,7 +71,7 @@ - Stepper 组件 size 属性支持 small middle large [\#306](https://github.com/youzan/vant-weapp/pull/306) ([jerryni](https://github.com/jerryni)) - 优化 Field 组件在列表中输入框表现 [\#296](https://github.com/youzan/vant-weapp/pull/296) ([pangxie1991](https://github.com/pangxie1991)) - datepicker 使用原生 picker-view 重写 [\#294](https://github.com/youzan/vant-weapp/pull/294) ([realywithoutname](https://github.com/realywithoutname)) -- Noticebar 组件支持动态更新text [\#314](https://github.com/youzan/vant-weapp/pull/314) ([rex-zsd](https://github.com/rex-zsd)) +- NoticeBar 组件支持动态更新text [\#314](https://github.com/youzan/vant-weapp/pull/314) ([rex-zsd](https://github.com/rex-zsd)) - datetime-picker 组件在 demo 中增加 datetime 示例入口 [\#313](https://github.com/youzan/vant-weapp/pull/313) ([rex-zsd](https://github.com/rex-zsd)) @@ -168,7 +168,7 @@ **Bug Fixes** - 修复 Field 组件圆角输入框,边框显示问题 [\#134](https://github.com/youzan/vant-weapp/pull/134) ([pangxie1991](https://github.com/pangxie1991)) -- 修复 Noticebar 组件元素查询返回空,导致报错的问题 [\#130](https://github.com/youzan/vant-weapp/pull/130) ([pangxie1991](https://github.com/pangxie1991)) +- 修复 NoticeBar 组件元素查询返回空,导致报错的问题 [\#130](https://github.com/youzan/vant-weapp/pull/130) ([pangxie1991](https://github.com/pangxie1991)) ## [v2.4.5](https://github.com/youzan/vant-weapp/tree/v2.4.5) (2018-02-07) [Full Changelog](https://github.com/youzan/vant-weapp/compare/v2.4.4...v2.4.5) @@ -302,7 +302,7 @@ **Improvements** - \[new feature\] 增加发布脚本 [\#35](https://github.com/youzan/vant-weapp/pull/35) ([pangxie1991](https://github.com/pangxie1991)) -- \[new feature\] 增加Capsule, Noticebar, Popup;修正Dialog在非最外层情况下引入的样式问题;更新readme。 [\#32](https://github.com/youzan/vant-weapp/pull/32) ([everywill](https://github.com/everywill)) +- \[new feature\] 增加Capsule, NoticeBar, Popup;修正Dialog在非最外层情况下引入的样式问题;更新readme。 [\#32](https://github.com/youzan/vant-weapp/pull/32) ([everywill](https://github.com/everywill)) - \[new feature\] 增加单选 和一个验证码的样式 [\#30](https://github.com/youzan/vant-weapp/pull/30) ([muzea](https://github.com/muzea)) - \[new feature\] Docs: 文档更新 [\#29](https://github.com/youzan/vant-weapp/pull/29) ([pangxie1991](https://github.com/pangxie1991)) diff --git a/dist/noticebar/index.js b/dist/noticebar/index.js index aacfaf61..0f9909b3 100644 --- a/dist/noticebar/index.js +++ b/dist/noticebar/index.js @@ -89,7 +89,7 @@ Component({ _init: function _init() { var _this = this; - wx.createSelectorQuery().in(this).select('.van-noticebar__content').boundingClientRect(function (rect) { + wx.createSelectorQuery().in(this).select('.van-notice-bar__content').boundingClientRect(function (rect) { if (!rect || !rect.width) { return; } @@ -97,7 +97,7 @@ Component({ width: rect.width }); - wx.createSelectorQuery().in(_this).select('.van-noticebar__content-wrap').boundingClientRect(function (rect) { + wx.createSelectorQuery().in(_this).select('.van-notice-bar__content-wrap').boundingClientRect(function (rect) { if (!rect || !rect.width) { return; } diff --git a/dist/noticebar/index.wxml b/dist/noticebar/index.wxml index b72197ef..e142a1a9 100644 --- a/dist/noticebar/index.wxml +++ b/dist/noticebar/index.wxml @@ -1,13 +1,13 @@ - + - - + + {{ text }} @@ -15,7 +15,7 @@ @@ -24,7 +24,7 @@ url="{{ url }}" open-type="{{ openType }}" > - + diff --git a/dist/noticebar/index.wxss b/dist/noticebar/index.wxss index 428be70b..29fb6cbf 100644 --- a/dist/noticebar/index.wxss +++ b/dist/noticebar/index.wxss @@ -1 +1 @@ -.van-noticebar{display:-webkit-box;display:flex;padding:9px 10px;font-size:12px;line-height:1.5}.van-noticebar--within-icon{position:relative;padding-right:30px}.van-noticebar__left-icon{height:18px;min-width:20px;padding-top:1px;box-sizing:border-box}.van-noticebar__left-icon>image{width:16px;height:16px}.van-noticebar__right-icon{position:absolute;top:10px;right:10px;font-size:15px;line-height:1}.van-noticebar__content-wrap{position:relative;-webkit-box-flex:1;flex:1;height:18px;overflow:hidden}.van-noticebar__content{position:absolute;white-space:nowrap} \ No newline at end of file +.van-notice-bar{display:-webkit-box;display:flex;padding:9px 10px;font-size:12px;line-height:1.5}.van-notice-bar--within-icon{position:relative;padding-right:30px}.van-notice-bar__left-icon{height:18px;min-width:20px;padding-top:1px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:10px;font-size:15px;line-height:1}.van-notice-bar__content-wrap{position:relative;-webkit-box-flex:1;flex:1;height:18px;overflow:hidden}.van-notice-bar__content{position:absolute;white-space:nowrap} \ No newline at end of file diff --git a/doc.config.js b/doc.config.js index 9e08253e..d424abc1 100644 --- a/doc.config.js +++ b/doc.config.js @@ -71,7 +71,7 @@ module.exports = { tag: require('./packages/tag/README.md'), badge: require('./packages/badge/README.md'), capsule: require('./packages/capsule/README.md'), - noticebar: require('./packages/noticebar/README.md'), + notice-bar: require('./packages/notice-bar/README.md'), steps: require('./packages/steps/README.md') } }, diff --git a/example/app.json b/example/app.json index c10a8d11..95cb40b9 100644 --- a/example/app.json +++ b/example/app.json @@ -14,7 +14,7 @@ "pages/icon/index", "pages/layout/index", "pages/loading/index", - "pages/noticebar/index", + "pages/notice-bar/index", "pages/panel/index", "pages/popup/index", "pages/radio/index", diff --git a/example/pages/dashboard/config.js b/example/pages/dashboard/config.js index b76b7111..5687cade 100644 --- a/example/pages/dashboard/config.js +++ b/example/pages/dashboard/config.js @@ -30,8 +30,8 @@ export default { name: 'loading 加载', path: '/pages/loading/index' }, { - name: 'Noticebar 通告栏', - path: '/pages/noticebar/index' + name: 'NoticeBar 通告栏', + path: '/pages/notice-bar/index' }, { name: 'Panel 面板', path: '/pages/panel/index' diff --git a/example/pages/helper/index.js b/example/pages/helper/index.js index 454020c0..560d44d4 100644 --- a/example/pages/helper/index.js +++ b/example/pages/helper/index.js @@ -1,11 +1 @@ -Page({ - data: { - }, - - onLoad: function () { - - }, - - onShow: function() { - }, -}) +Page({}); diff --git a/example/pages/noticebar/index.js b/example/pages/notice-bar/index.js similarity index 99% rename from example/pages/noticebar/index.js rename to example/pages/notice-bar/index.js index f3edc73f..65bf5936 100644 --- a/example/pages/noticebar/index.js +++ b/example/pages/notice-bar/index.js @@ -25,4 +25,4 @@ Page({ speed: 10 } } -}) +}); diff --git a/example/pages/notice-bar/index.json b/example/pages/notice-bar/index.json new file mode 100644 index 00000000..d4c7e5b2 --- /dev/null +++ b/example/pages/notice-bar/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "NoticeBar 通告栏", + "usingComponents": { + "van-notice-bar": "../../dist/notice-bar/index", + "van-panel": "../../dist/panel/index" + } +} diff --git a/example/pages/noticebar/index.wxml b/example/pages/notice-bar/index.wxml similarity index 87% rename from example/pages/noticebar/index.wxml rename to example/pages/notice-bar/index.wxml index 5aac8d48..90f212ed 100644 --- a/example/pages/noticebar/index.wxml +++ b/example/pages/notice-bar/index.wxml @@ -1,13 +1,13 @@ - - - - - - - diff --git a/example/pages/noticebar/index.json b/example/pages/noticebar/index.json deleted file mode 100644 index d3916404..00000000 --- a/example/pages/noticebar/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "navigationBarTitleText": "Noticebar 通告栏", - "usingComponents": { - "van-noticebar": "../../dist/noticebar/index", - "van-panel": "../../dist/panel/index" - } -} diff --git a/packages/helper/common/clearfix.pcss b/packages/helper/common/clearfix.pcss index 2c6adead..2561e8cd 100644 --- a/packages/helper/common/clearfix.pcss +++ b/packages/helper/common/clearfix.pcss @@ -1,5 +1,5 @@ @import '../mixins/clearfix.pcss'; .van-clearfix { - @mixin ellipsis; + @mixin clearfix; } diff --git a/packages/noticebar/README.md b/packages/notice-bar/README.md similarity index 82% rename from packages/noticebar/README.md rename to packages/notice-bar/README.md index 9cc8f87b..3f366ac0 100644 --- a/packages/noticebar/README.md +++ b/packages/notice-bar/README.md @@ -1,18 +1,18 @@ -## Noticebar 通告栏 +## NoticeBar 通告栏 ### 使用指南 在 index.json 中引入组件 ```json { "usingComponents": { - "van-noticebar": "path/to/vant-weapp/dist/noticebar/index" + "van-notice-bar": "path/to/vant-weapp/dist/notice-bar/index" } } ``` 在 index.js 中声明组件数据 ```js -// 在 Page 中声明 Noticebar 依赖的展示数据 +// 在 Page 中声明 NoticeBar 依赖的展示数据 Page({ data: { text: 'xxx', @@ -23,18 +23,18 @@ Page({ ``` ### 代码演示 -`Noticebar` 组件支持滚动和静止两种展示方式,通过 text 传入展示文案 +`NoticeBar` 组件支持滚动和静止两种展示方式,通过 text 传入展示文案 ### 静止公告栏 ```html - ``` ### 滚动通告栏 ```html - @@ -42,7 +42,7 @@ Page({ ### 延时滚动通告栏 ```html - @@ -77,7 +77,7 @@ Page({ ### 可关闭通告栏 ```html - diff --git a/packages/noticebar/index.js b/packages/notice-bar/index.js similarity index 96% rename from packages/noticebar/index.js rename to packages/notice-bar/index.js index 73e503db..667b4db8 100644 --- a/packages/noticebar/index.js +++ b/packages/notice-bar/index.js @@ -7,7 +7,7 @@ Component({ text: { type: String, value: '', - observer(newVal) { + observer() { this.setData({}, this._init); } }, @@ -86,7 +86,7 @@ Component({ _init() { wx.createSelectorQuery() .in(this) - .select('.van-noticebar__content') + .select('.van-notice-bar__content') .boundingClientRect((rect) => { if (!rect || !rect.width) { return; @@ -97,7 +97,7 @@ Component({ wx.createSelectorQuery() .in(this) - .select('.van-noticebar__content-wrap') + .select('.van-notice-bar__content-wrap') .boundingClientRect((rect) => { if (!rect || !rect.width) { return; diff --git a/packages/noticebar/index.json b/packages/notice-bar/index.json similarity index 100% rename from packages/noticebar/index.json rename to packages/notice-bar/index.json diff --git a/packages/noticebar/index.pcss b/packages/notice-bar/index.pcss similarity index 97% rename from packages/noticebar/index.pcss rename to packages/notice-bar/index.pcss index 284ce971..29c87785 100644 --- a/packages/noticebar/index.pcss +++ b/packages/notice-bar/index.pcss @@ -1,4 +1,4 @@ -.van-noticebar { +.van-notice-bar { display: flex; padding: 9px 10px; font-size: 12px; diff --git a/packages/noticebar/index.wxml b/packages/notice-bar/index.wxml similarity index 53% rename from packages/noticebar/index.wxml rename to packages/notice-bar/index.wxml index b72197ef..cce0c5b9 100644 --- a/packages/noticebar/index.wxml +++ b/packages/notice-bar/index.wxml @@ -1,13 +1,13 @@ - + - - + + {{ text }} @@ -15,8 +15,8 @@ - +