mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[build] 3.0.9
This commit is contained in:
parent
bf652cb425
commit
0c1ddf7c7a
1
dist/btn/index.wxml
vendored
1
dist/btn/index.wxml
vendored
@ -18,6 +18,7 @@
|
||||
bindgetuserinfo="bindgetuserinfo"
|
||||
bindgetphonenumber="bindgetphonenumber"
|
||||
binderror="binderror"
|
||||
bindopensetting="bindopensetting"
|
||||
>
|
||||
<slot></slot>
|
||||
</button>
|
||||
|
9
dist/btn/native-button-behaviors.js
vendored
9
dist/btn/native-button-behaviors.js
vendored
@ -56,11 +56,18 @@ module.exports = Behavior({
|
||||
|
||||
this.triggerEvent('getphonenumber', detail);
|
||||
},
|
||||
binderror: function binderror() {
|
||||
bindopensetting: function bindopensetting() {
|
||||
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref4$detail = _ref4.detail,
|
||||
detail = _ref4$detail === undefined ? {} : _ref4$detail;
|
||||
|
||||
this.triggerEvent('opensetting', detail);
|
||||
},
|
||||
binderror: function binderror() {
|
||||
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
_ref5$detail = _ref5.detail,
|
||||
detail = _ref5$detail === undefined ? {} : _ref5$detail;
|
||||
|
||||
this.triggerEvent('error', detail);
|
||||
}
|
||||
}
|
||||
|
10
dist/cell-group/index.js
vendored
10
dist/cell-group/index.js
vendored
@ -6,6 +6,12 @@ var CELL_PATH = '../cell/index';
|
||||
var FIELD_PATH = '../field/index';
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
titleWidth: {
|
||||
type: Number,
|
||||
value: null
|
||||
}
|
||||
},
|
||||
relations: (_relations = {}, _relations[CELL_PATH] = {
|
||||
type: 'child',
|
||||
linked: function linked() {
|
||||
@ -46,10 +52,14 @@ Component({
|
||||
var elementUpdateTimeout = setTimeout(function () {
|
||||
_this.setData({ elementUpdateTimeout: 0 });
|
||||
var elements = _this.getRelationNodes(childPath);
|
||||
var titleWidth = _this.properties.titleWidth;
|
||||
|
||||
|
||||
if (elements.length > 0) {
|
||||
var lastIndex = elements.length - 1;
|
||||
|
||||
elements.forEach(function (cell, index) {
|
||||
titleWidth && cell.setTitleWidth(titleWidth);
|
||||
cell.updateIsLastElement(index === lastIndex);
|
||||
});
|
||||
}
|
||||
|
16
dist/cell/index.js
vendored
16
dist/cell/index.js
vendored
@ -5,7 +5,7 @@ var warn = function warn(msg, getValue) {
|
||||
};
|
||||
|
||||
Component({
|
||||
externalClasses: ['cell-class'],
|
||||
externalClasses: ['cell-class', 'title-class'],
|
||||
options: {
|
||||
multipleSlots: true
|
||||
},
|
||||
@ -44,10 +44,12 @@ Component({
|
||||
url: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
noBorder: Boolean
|
||||
},
|
||||
data: {
|
||||
isLastCell: true
|
||||
isLastCell: true,
|
||||
titleWidth: 'auto'
|
||||
},
|
||||
methods: {
|
||||
footerTap: function footerTap() {
|
||||
@ -73,6 +75,14 @@ Component({
|
||||
// 用于被 cell-group 更新,标志是否是最后一个 cell
|
||||
updateIsLastElement: function updateIsLastElement(isLastCell) {
|
||||
this.setData({ isLastCell: isLastCell });
|
||||
},
|
||||
|
||||
|
||||
// 设置统一的title区域宽度
|
||||
setTitleWidth: function setTitleWidth(titleWidth) {
|
||||
this.setData({
|
||||
titleWidth: titleWidth + 'px'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
7
dist/cell/index.wxml
vendored
7
dist/cell/index.wxml
vendored
@ -1,15 +1,18 @@
|
||||
<view
|
||||
catchtap="cellTap"
|
||||
class="cell-class zan-cell {{ isLastCell ? 'last-cell' : '' }} {{ isLink ? 'zan-cell--access' : '' }}"
|
||||
class="cell-class zan-cell {{ isLastCell ? 'last-cell' : '' }} {{ isLink ? 'zan-cell--access' : '' }} {{ noBorder ? 'no-border' : ''}}"
|
||||
>
|
||||
|
||||
<view class="zan-cell__icon">
|
||||
<slot name="icon"></slot>
|
||||
</view>
|
||||
|
||||
<view class="zan-cell__bd">
|
||||
<view class="title-class zan-cell__title" style="width: {{ titleWidth }}">
|
||||
<view wx:if="{{ title }}" class="zan-cell__text">{{ title }}</view>
|
||||
<view wx:if="{{ label }}" class="zan-cell__desc">{{ label }}</view>
|
||||
</view>
|
||||
|
||||
<view class="zan-cell__bd">
|
||||
<slot></slot>
|
||||
</view>
|
||||
|
||||
|
2
dist/cell/index.wxss
vendored
2
dist/cell/index.wxss
vendored
@ -1 +1 @@
|
||||
.zan-cell{position:relative;padding:12px 15px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;line-height:1.4;background-color:#fff;font-size:14px}.zan-cell::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-bottom-width:1px;left:15px;right:0}.zan-cell .zan-cell__icon{margin-right:5px}.zan-cell .zan-cell__icon:empty{display:none}.zan-cell__bd{-webkit-box-flex:1;flex:1}.zan-cell__text{line-height:24px;font-size:14px}.zan-cell__desc{line-height:1.2;font-size:12px;color:#666}.zan-cell__ft{position:relative;text-align:right;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-cell::after{display:none}.zan-cell--access .zan-cell__ft{padding-right:13px}.zan-cell--access .zan-cell__ft::after{position:absolute;top:50%;right:2px;content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8c8;border-style:solid;-webkit-transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0);transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}.zan-cell--switch{padding-top:6px;padding-bottom:6px}
|
||||
.zan-cell{position:relative;padding:12px 15px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;line-height:1.4;background-color:#fff;font-size:14px}.zan-cell::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-bottom-width:1px;left:15px;right:0}.zan-cell__icon{margin-right:5px}.zan-cell__icon:empty{display:none}.zan-cell__title{min-width:65px;padding-right:10px}.zan-cell__title:empty{display:none}.zan-cell__bd{-webkit-box-flex:1;flex:1}.zan-cell__text{line-height:24px;font-size:14px}.zan-cell__desc{line-height:1.2;font-size:12px;color:#666}.zan-cell__ft{position:relative;text-align:right;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-cell::after,.zan-cell.no-border::after{display:none}.zan-cell--access .zan-cell__ft{padding-right:13px}.zan-cell--access .zan-cell__ft::after{position:absolute;top:50%;right:2px;content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8c8;border-style:solid;-webkit-transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0);transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}.zan-cell--switch{padding-top:6px;padding-bottom:6px}
|
14
dist/checkbox/index.wxml
vendored
14
dist/checkbox/index.wxml
vendored
@ -1,25 +1,13 @@
|
||||
<view
|
||||
class="checkbox-class zan-checkbox {{ isInGroup ? 'zan-checkbox__item' : ''}} {{ type === 'list' ? 'zan-checkbox__list-item' : ''}}"
|
||||
bindtap="{{ labelDisabled ? '' : 'handleClick' }}"
|
||||
data-id="test"
|
||||
>
|
||||
<zan-icon
|
||||
type="{{ checked ? 'checked' : 'check'}}"
|
||||
class="zan-checkbox__icon {{ 'zan-checkbox--' + shape }} {{ disabled ? 'zan-checkbox--disabled' : '' }} {{ checked ? 'zan-checkbox--checked' : '' }}"
|
||||
class="zan-checkbox__icon {{ disabled ? 'zan-checkbox--disabled' : '' }} {{ checked ? 'zan-checkbox--checked' : '' }}"
|
||||
bindtap="{{ labelDisabled ? 'handleClick': '' }}"
|
||||
></zan-icon>
|
||||
<text class="zan-checkbox__label">
|
||||
<slot></slot>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<wxs module="parse">
|
||||
function getColor(color) {
|
||||
color = color || '#ff4444'
|
||||
return color;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getColor: getColor
|
||||
};
|
||||
</wxs>
|
||||
|
4
dist/dialog/data.js
vendored
4
dist/dialog/data.js
vendored
@ -20,5 +20,7 @@ module.exports = {
|
||||
// 取消按钮文案
|
||||
cancelButtonText: '取消',
|
||||
// 取消按钮颜色
|
||||
cancelButtonColor: '#333'
|
||||
cancelButtonColor: '#333',
|
||||
// 点击按钮自动关闭 dialog
|
||||
autoClose: true
|
||||
};
|
56
dist/dialog/dialog.js
vendored
56
dist/dialog/dialog.js
vendored
@ -2,21 +2,37 @@
|
||||
|
||||
var defaultData = require('./data');
|
||||
|
||||
// options 使用参数
|
||||
// pageCtx 页面 page 上下文
|
||||
function Dialog(options, pageCtx) {
|
||||
var parsedOptions = Object.assign({
|
||||
// 自定义 btn 列表
|
||||
// { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色 }
|
||||
buttons: []
|
||||
}, defaultData, options);
|
||||
function getDialogCtx(_ref) {
|
||||
var selector = _ref.selector,
|
||||
pageCtx = _ref.pageCtx;
|
||||
|
||||
var ctx = pageCtx;
|
||||
if (!ctx) {
|
||||
var pages = getCurrentPages();
|
||||
ctx = pages[pages.length - 1];
|
||||
}
|
||||
var dialogCtx = ctx.selectComponent(parsedOptions.selector);
|
||||
return ctx.selectComponent(selector);
|
||||
}
|
||||
|
||||
function getParsedOptions() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return Object.assign({
|
||||
// 自定义 btn 列表
|
||||
// { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色 }
|
||||
buttons: []
|
||||
}, defaultData, options);
|
||||
}
|
||||
|
||||
// options 使用参数
|
||||
// pageCtx 页面 page 上下文
|
||||
function Dialog(options, pageCtx) {
|
||||
var parsedOptions = getParsedOptions(options);
|
||||
|
||||
var dialogCtx = getDialogCtx({
|
||||
selector: parsedOptions.selector,
|
||||
pageCtx: pageCtx
|
||||
});
|
||||
|
||||
if (!dialogCtx) {
|
||||
console.error('无法找到对应的dialog组件,请于页面中注册并在 wxml 中声明 dialog 自定义组件');
|
||||
@ -60,9 +76,29 @@ function Dialog(options, pageCtx) {
|
||||
showCustomBtns: showCustomBtns,
|
||||
key: '' + new Date().getTime(),
|
||||
show: true,
|
||||
promiseFunc: { resolve: resolve, reject: reject }
|
||||
promiseFunc: { resolve: resolve, reject: reject },
|
||||
openTypePromiseFunc: null
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Dialog.close = function (options, pageCtx) {
|
||||
var parsedOptions = getParsedOptions(options);
|
||||
|
||||
var dialogCtx = getDialogCtx({
|
||||
selector: parsedOptions.selector,
|
||||
pageCtx: pageCtx
|
||||
});
|
||||
|
||||
if (!dialogCtx) {
|
||||
return;
|
||||
}
|
||||
|
||||
dialogCtx.setData({
|
||||
show: false,
|
||||
promiseFunc: null,
|
||||
openTypePromiseFunc: null
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = Dialog;
|
67
dist/dialog/index.js
vendored
67
dist/dialog/index.js
vendored
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var _f = function _f() {};
|
||||
var needResponseOpenTypes = ['getUserInfo', 'getPhoneNumber', 'openSetting'];
|
||||
|
||||
Component({
|
||||
properties: {},
|
||||
@ -9,7 +10,7 @@ Component({
|
||||
// 标题
|
||||
title: '',
|
||||
// 自定义 btn 列表
|
||||
// { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色 }
|
||||
// { type: 按钮类型,回调时以此作为区分依据,text: 按钮文案, color: 按钮文字颜色, openType: 微信开放能力 }
|
||||
buttons: [],
|
||||
// 内容
|
||||
message: ' ',
|
||||
@ -30,13 +31,17 @@ Component({
|
||||
// 取消按钮颜色
|
||||
cancelButtonColor: '#333',
|
||||
key: '',
|
||||
autoClose: true,
|
||||
show: false,
|
||||
showCustomBtns: false,
|
||||
promiseFunc: {}
|
||||
promiseFunc: {},
|
||||
openTypePromiseFunc: {}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleButtonClick: function handleButtonClick(e) {
|
||||
var _this = this;
|
||||
|
||||
var _e$currentTarget = e.currentTarget,
|
||||
currentTarget = _e$currentTarget === undefined ? {} : _e$currentTarget;
|
||||
var _currentTarget$datase = currentTarget.dataset,
|
||||
@ -53,15 +58,22 @@ Component({
|
||||
// 重置展示
|
||||
|
||||
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
if (this.data.autoClose) {
|
||||
this.setData({ show: false });
|
||||
}
|
||||
|
||||
// 自定义按钮,全部 resolve 形式返回,根据 type 区分点击按钮
|
||||
if (this.data.showCustomBtns) {
|
||||
resolve({
|
||||
type: dataset.type
|
||||
var isNeedOpenDataButton = needResponseOpenTypes.indexOf(dataset.openType) > -1;
|
||||
var resolveData = { type: dataset.type };
|
||||
// 如果需要 openData,就额外返回一个 promise,用于后续 open 数据返回
|
||||
if (isNeedOpenDataButton) {
|
||||
resolveData.openDataPromise = new Promise(function (resolve, reject) {
|
||||
_this.setData({ openTypePromiseFunc: { resolve: resolve, reject: reject } });
|
||||
});
|
||||
resolveData.hasOpenDataPromise = true;
|
||||
}
|
||||
resolve(resolveData);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -75,6 +87,47 @@ Component({
|
||||
type: 'cancel'
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({ promiseFunc: {} });
|
||||
},
|
||||
|
||||
|
||||
// 以下为处理微信按钮开放能力的逻辑
|
||||
handleUserInfoResponse: function handleUserInfoResponse(_ref2) {
|
||||
var detail = _ref2.detail;
|
||||
|
||||
this.__handleOpenDataResponse({
|
||||
type: detail.errMsg === 'getUserInfo:ok' ? 'resolve' : 'reject',
|
||||
data: detail
|
||||
});
|
||||
},
|
||||
handlePhoneResponse: function handlePhoneResponse(_ref3) {
|
||||
var detail = _ref3.detail;
|
||||
|
||||
this.__handleOpenDataResponse({
|
||||
type: detail.errMsg === 'getPhoneNumber:ok' ? 'resolve' : 'reject',
|
||||
data: detail
|
||||
});
|
||||
},
|
||||
handleOpenSettingResponse: function handleOpenSettingResponse(_ref4) {
|
||||
var detail = _ref4.detail;
|
||||
|
||||
this.__handleOpenDataResponse({
|
||||
type: detail.errMsg === 'openSetting:ok' ? 'resolve' : 'reject',
|
||||
data: detail
|
||||
});
|
||||
},
|
||||
__handleOpenDataResponse: function __handleOpenDataResponse(_ref5) {
|
||||
var _ref5$type = _ref5.type,
|
||||
type = _ref5$type === undefined ? 'resolve' : _ref5$type,
|
||||
_ref5$data = _ref5.data,
|
||||
data = _ref5$data === undefined ? {} : _ref5$data;
|
||||
|
||||
var promiseFuncs = this.data.openTypePromiseFunc || {};
|
||||
var responseFunc = promiseFuncs[type] || _f;
|
||||
|
||||
responseFunc(data);
|
||||
this.setData({ openTypePromiseFunc: null });
|
||||
}
|
||||
}
|
||||
});
|
4
dist/dialog/index.wxml
vendored
4
dist/dialog/index.wxml
vendored
@ -23,8 +23,12 @@
|
||||
class="zan-dialog__button"
|
||||
custom-class="{{ index === 0 ? 'zan-dialog__button-inside--first' : 'zan-dialog__button-inside' }}"
|
||||
data-type="{{ item.type }}"
|
||||
data-open-type="{{ item.openType }}"
|
||||
open-type="{{ item.openType }}"
|
||||
bind:btnclick="handleButtonClick"
|
||||
bind:getuserinfo="handleUserInfoResponse"
|
||||
bind:getphonenumber="handlePhoneResponse"
|
||||
bind:opensetting="handleOpenSettingResponse"
|
||||
>
|
||||
<view
|
||||
style="color: {{ item.color || '#333' }}"
|
||||
|
14
dist/loadmore/index.js
vendored
Normal file
14
dist/loadmore/index.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
type: {
|
||||
type: String,
|
||||
value: 'loading'
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
}
|
||||
});
|
3
dist/loadmore/index.json
vendored
Normal file
3
dist/loadmore/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
30
dist/loadmore/index.wxml
vendored
30
dist/loadmore/index.wxml
vendored
@ -1,24 +1,12 @@
|
||||
<template name="zan-loadmore">
|
||||
|
||||
<block wx:if="{{nomore}}">
|
||||
<view class="zan-loadmore zan-loadmore--nomore">
|
||||
<view class="zan-loadmore__tips">
|
||||
<view class="zan-loadmore__dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{nodata}}">
|
||||
<view class="zan-loadmore zan-loadmore--nodata">
|
||||
<view class="zan-loadmore__tips">{{ nodata_str || '暂无数据' }}</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{loading}}">
|
||||
<view class="zan-loadmore">
|
||||
<view class="zan-loadmore">
|
||||
<block wx:if="{{ type === 'loading' }}">
|
||||
<view class="zan-loading"></view>
|
||||
<view class="zan-loadmore__tips">加载中...</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</template>
|
||||
<block wx:elif="{{ type === 'text' }}">
|
||||
<view class="zan-loadmore__line"></view>
|
||||
<text wx:if="{{ text }}" class="zan-loadmore__text">{{ text }}</text>
|
||||
<view wx:else class="zan-loadmore__dot"></view>
|
||||
<view class="zan-loadmore__line"></view>
|
||||
</block>
|
||||
</view>
|
2
dist/loadmore/index.wxss
vendored
2
dist/loadmore/index.wxss
vendored
@ -1 +1 @@
|
||||
.zan-loadmore{position:relative;width:65%;margin:21px auto;line-height:20px;font-size:14px;text-align:center;vertical-align:middle}.zan-loading{width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:weuiLoading 1s steps(12,end) infinite;animation:weuiLoading 1s steps(12,end) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iciIgd2lkdGg9JzEyMHB4JyBoZWlnaHQ9JzEyMHB4JyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICAgIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBmaWxsPSJub25lIiBjbGFzcz0iYmsiPjwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjRTlFOUU5JwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoMCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICA8L3JlY3Q+CiAgICA8cmVjdCB4PSc0Ni41JyB5PSc0MCcgd2lkdGg9JzcnIGhlaWdodD0nMjAnIHJ4PSc1JyByeT0nNScgZmlsbD0nIzk4OTY5NycKICAgICAgICAgIHRyYW5zZm9ybT0ncm90YXRlKDMwIDUwIDUwKSB0cmFuc2xhdGUoMCAtMzApJz4KICAgICAgICAgICAgICAgICByZXBlYXRDb3VudD0naW5kZWZpbml0ZScvPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyM5Qjk5OUEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSg2MCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9J2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ByeD0nNScgcnk9JzUnIGZpbGw9JyNDQkNCQ0InCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEMkQyRDInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEQURBREEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNFMkUyRTInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0Pgo8L3N2Zz4=) no-repeat;background-size:100%}.zan-loadmore .zan-loading{margin-right:4px}.zan-loadmore__tips{display:inline-block;vertical-align:middle;height:20px;line-height:20px}.zan-loadmore--nodata,.zan-loadmore--nomore{color:#999}.zan-loadmore--nodata::after,.zan-loadmore--nomore::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-top-width:1px}.zan-loadmore--nodata{margin-top:120px}.zan-loadmore--nodata .zan-loadmore__tips{position:relative;top:-11px;background:#f9f9f9;padding:0 6px;z-index:1}.zan-loadmore--nomore .zan-loadmore__tips{position:relative;top:-11px;background:#f9f9f9;padding:0 6px;z-index:1}.zan-loadmore__dot{position:absolute;left:50%;top:10px;margin-left:-2px;margin-top:-2px;content:" ";width:4px;height:4px;border-radius:50%;background-color:#e5e5e5;display:inline-block;vertical-align:middle}
|
||||
.zan-loadmore{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;min-height:24px;line-height:24px;font-size:12px}.zan-loadmore__line{-webkit-box-flex:1;flex:1;height:1px;position:relative}.zan-loadmore__line::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:0 0;transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e5e5e5;border-bottom-width:1px}.zan-loadmore__dot,.zan-loadmore__text{margin:0 5px}.zan-loadmore__dot{content:"";width:4px;height:4px;border-radius:50%;background-color:#e5e5e5;display:inline-block;vertical-align:middle}.zan-loading{width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:weuiLoading 1s steps(12,end) infinite;animation:weuiLoading 1s steps(12,end) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iciIgd2lkdGg9JzEyMHB4JyBoZWlnaHQ9JzEyMHB4JyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICAgIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBmaWxsPSJub25lIiBjbGFzcz0iYmsiPjwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjRTlFOUU5JwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoMCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICA8L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nIGZpbGw9JyNFMkUyRTInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0Pgo8L3N2Zz4=) no-repeat;background-size:100%}.zan-loadmore__tips{display:inline-block;vertical-align:middle;height:24px;line-height:24px}
|
33
dist/radio/index.js
vendored
Normal file
33
dist/radio/index.js
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
Component({
|
||||
behaviors: ['wx://form-field'],
|
||||
|
||||
externalClasses: ['radio-class', 'radio-color'],
|
||||
|
||||
properties: {
|
||||
items: Array,
|
||||
type: String
|
||||
},
|
||||
|
||||
methods: {
|
||||
radioChange: function radioChange(e) {
|
||||
this.selectItem(e.detail.value);
|
||||
this.triggerEvent('change', e);
|
||||
},
|
||||
selectItem: function selectItem(value) {
|
||||
var items = this.data.items;
|
||||
|
||||
|
||||
items.forEach(function (item) {
|
||||
if (item.name === value) {
|
||||
item.checked = true;
|
||||
} else {
|
||||
item.checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.setData({ items: items });
|
||||
}
|
||||
}
|
||||
});
|
6
dist/radio/index.json
vendored
Normal file
6
dist/radio/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"zan-icon": "../icon/index"
|
||||
}
|
||||
}
|
28
dist/radio/index.wxml
vendored
Normal file
28
dist/radio/index.wxml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<radio-group
|
||||
class="zan-radio radio-class"
|
||||
bindchange="radioChange"
|
||||
wx:if="{{ items && items.length }}"
|
||||
>
|
||||
<label
|
||||
class="zan-radio__label {{ type === 'list' ? 'zan-radio__list-item' : 'zan-radio__item'}}"
|
||||
wx:for="{{ items }}"
|
||||
wx:key="{{ item.value }}"
|
||||
wx:for-item="item"
|
||||
wx:for-index="index"
|
||||
>
|
||||
<view class="zan-radio__icon-wrap">
|
||||
<view class="zan-radio__icon {{ item.disabled ? 'zan-radio--disabled' : '' }} {{ item.checked ? 'zan-radio--checked radio-color' : '' }}">
|
||||
<view class="zan-radio__icon-inside"></view>
|
||||
</view>
|
||||
<radio
|
||||
class="zan-radio__origin"
|
||||
value="{{ item.name }}"
|
||||
checked="{{ item.checked }}"
|
||||
disabled="{{ item.disabled }}"
|
||||
/>
|
||||
</view>
|
||||
<view class="zan-radio__name">
|
||||
{{item.value}}
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
1
dist/radio/index.wxss
vendored
Normal file
1
dist/radio/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
.zan-radio{display:block;padding:0 10px;font-size:14px}.zan-radio__item{display:block;margin-top:10px;height:20px}.zan-radio__item:last-child{margin-bottom:10px}.zan-radio__list-item{display:block;padding:10px 10px 10px 0;border-bottom:1px solid #e5e5e5}.zan-radio__list-item .zan-radio__icon-wrap{float:right;margin-top:3px}.zan-radio__icon-wrap{position:relative;width:14px;height:15px;display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;color:#aaa}.zan-radio__icon-wrap .zan-radio__origin{opacity:0;width:14px;height:20px}.zan-radio__icon-wrap .zan-radio__icon{position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);border:1px solid #dcdfe6;border-radius:100%;width:14px;height:14px;background-color:#fff;cursor:pointer;box-sizing:border-box}.zan-radio__icon-wrap .zan-radio__icon .zan-radio__icon-inside{position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:4px;height:4px;border-radius:50%}.zan-radio__icon-wrap .zan-radio__icon.zan-radio--checked{border-color:#06bf04;background:#06bf04}.zan-radio__icon-wrap .zan-radio__icon.zan-radio--checked .zan-radio__icon-inside{background-color:#fff}.zan-radio__icon-wrap .zan-radio__icon.zan-radio--disabled{opacity:.6}.zan-radio__name{display:inline-block;margin-left:10px}
|
Loading…
x
Reference in New Issue
Block a user