From eba815b60f11e59e3044c8b049e647444745ff55 Mon Sep 17 00:00:00 2001 From: MuYu Date: Tue, 26 Sep 2017 23:33:49 -0500 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E9=80=89=20?= =?UTF-8?q?=E5=92=8C=E4=B8=80=E4=B8=AA=E9=AA=8C=E8=AF=81=E7=A0=81=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=20(#30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加单选 和一个验证码的样式 * 移除一个不存在的页面链接 * 移除业务中的样式 * 统一风格 --- dist/cell/index.wxss | 13 +++++++++++++ dist/form/check_label.js | 26 ++++++++++++++++++++++++++ dist/form/check_label.wxml | 23 +++++++++++++++++++++++ dist/form/check_label.wxss | 6 ++++++ dist/index.js | 1 + dist/index.wxss | 3 ++- example/form/index.js | 26 +++++++++++++++++++++++--- example/form/index.wxml | 38 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 dist/form/check_label.js create mode 100644 dist/form/check_label.wxml create mode 100644 dist/form/check_label.wxss diff --git a/dist/cell/index.wxss b/dist/cell/index.wxss index ee63bdde..43ca13ed 100644 --- a/dist/cell/index.wxss +++ b/dist/cell/index.wxss @@ -25,6 +25,19 @@ color: #666; } +.zan-cell__no-pading{ + padding: 0; +} +.zan-cell__no-pading .zan-cell__bd_padding { + padding: 12px 0 12px 15px; +} +.zan-cell__no-pading .zan-cell__bd_padding .zan-form__input{ + height: 26px; +} +.zan-cell__no-pading .zan-cell__ft_padding { + padding: 12px 15px 12px 0; +} + .zan-cell--last-child::after, .zan-cell:last-child::after { display: none; diff --git a/dist/form/check_label.js b/dist/form/check_label.js new file mode 100644 index 00000000..afbfb86b --- /dev/null +++ b/dist/form/check_label.js @@ -0,0 +1,26 @@ +function handle(e) { + var dataset = e.currentTarget.dataset; + var componentId = dataset.componentId; + var value = e.detail.value; + + callback.call(this, componentId, value); +} + +function callback(componentId, value) { + var e = { componentId, value }; + console.info('[zan:CheckLabel:select]', e); + + if (this.handleZanCheckLabelSelect) { + this.handleZanCheckLabelSelect(e); + } else { + console.warn('页面缺少 handleZanCheckLabelSelect 回调函数'); + } +} + +var CheckLabel = { + _handleZanCheckLabelSelect(e) { + handle.call(this, e); + }, +}; + +module.exports = CheckLabel; diff --git a/dist/form/check_label.wxml b/dist/form/check_label.wxml new file mode 100644 index 00000000..5e122ee7 --- /dev/null +++ b/dist/form/check_label.wxml @@ -0,0 +1,23 @@ + diff --git a/dist/form/check_label.wxss b/dist/form/check_label.wxss new file mode 100644 index 00000000..f9864c06 --- /dev/null +++ b/dist/form/check_label.wxss @@ -0,0 +1,6 @@ +.zan-check-label__list .zan-check-label__radio{ + display: none; +} +.zan-check-label__selected{ + color: #ff4444; +} diff --git a/dist/index.js b/dist/index.js index 6ba83f82..2d01615b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,3 +3,4 @@ exports.Quantity = require('./quantity/index'); exports.TopTips = require('./toptips/index'); exports.Toast = require('./toast/index'); exports.Switch = require('./switch/index'); +exports.CheckLabel = require('./form/check_label'); diff --git a/dist/index.wxss b/dist/index.wxss index d20deb49..154fb4bf 100644 --- a/dist/index.wxss +++ b/dist/index.wxss @@ -8,6 +8,7 @@ @import "badge/index.wxss"; @import "dialog/index.wxss"; @import "form/index.wxss"; +@import "form/check_label.wxss"; @import "tab/index.wxss"; @import "label/index.wxss"; @import "quantity/index.wxss"; @@ -15,4 +16,4 @@ @import "toast/index.wxss"; @import "toptips/index.wxss"; @import "icon/index.wxss"; -@import "switch/index.wxss"; +@import "switch/index.wxss"; \ No newline at end of file diff --git a/example/form/index.js b/example/form/index.js index e608dcfc..ce659eb6 100644 --- a/example/form/index.js +++ b/example/form/index.js @@ -1,8 +1,22 @@ +var Zan = require('../../dist/index'); -Page({ +Page(Object.assign({}, Zan.CheckLabel, { data: { area: ['省份', '北京市', '天津市', '河北省', '山西省', '内蒙古自治区', '辽宁省', '吉林省', '黑龙江省', '上海市', '江苏省', '浙江省', '安徽省', '福建省', '江西省', '山东省', '河南省', '湖北省', '湖南省', '广东省', '广西壮族自治区', '海南省', '重庆市', '四川省', '贵州省', '云南省', '西藏自治区', '陕西省', '甘肃省', '青海省', '宁夏回族自治区', '新疆维吾尔自治区', '台湾省', '香港特别行政区', '澳门特别行政区'], - areaIndex: 0 + areaIndex: 0, + items: [ + { + padding: 0, + value: '1', + name: '选项一', + }, + { + padding: 0, + value: '2', + name: '选项二', + }, + ], + checkedValue: -1, }, onLoad: function () { @@ -16,5 +30,11 @@ Page({ this.setData({ areaIndex: e.detail.value }); + }, + + handleZanCheckLabelSelect: function (e) { + this.setData({ + checkedValue: e.value + }); } -}); +})); diff --git a/example/form/index.wxml b/example/form/index.wxml index ec6640b3..ac4d04f4 100644 --- a/example/form/index.wxml +++ b/example/form/index.wxml @@ -1,3 +1,5 @@ + + FORM @@ -34,4 +36,40 @@ + + + + 验证码 + + + + + + + + + 验证码 + + + + + + + + + + +