diff --git a/dist/action-sheet/index.js b/dist/action-sheet/index.js index 616649e3..52446edd 100644 --- a/dist/action-sheet/index.js +++ b/dist/action-sheet/index.js @@ -1,125 +1,125 @@ Component({ - externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel'], - properties: { - locked: Boolean, - showCancel: Boolean, - show: Boolean, - itemList: Array, - cancelText: { - type: String, - value: '取消' - }, - title: String, - openApi: { - type: Boolean, - value: true, - } - }, - data: { - success: '', - fail: '', - isIphoneX: false - }, - attached() { - if (this.data.openApi) { - this.initActionSheet(); - } - this.initUIAdapter(); + externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel'], + properties: { + locked: Boolean, + showCancel: Boolean, + show: Boolean, + itemList: Array, + cancelText: { + type: String, + value: '取消' }, + title: String, + openApi: { + type: Boolean, + value: true, + } + }, + data: { + success: '', + fail: '', + isIphoneX: false + }, + attached() { + if (this.data.openApi) { + this.initActionSheet(); + } + this.initUIAdapter(); + }, - lifetimes: { - show() { - if (this.data.openApi) { - this.initActionSheet(); - } + lifetimes: { + show() { + if (this.data.openApi) { + this.initActionSheet(); + } - }, }, - methods: { - /** + }, + methods: { + /** * 区分UI尺寸 */ - initUIAdapter() { - wx.getSystemInfo({ - success: (res) => { - this.setData({ - isIphoneX: res.model == "iPhone X" ? true : false, - }) - } - }) - }, - initActionSheet() { - const config = { - itemList: [], - success: null, - fail: null, - title: '', - locked: true, - cancelText: '取消', - showCancel: false - } - wx.lin = wx.lin || {}; - wx.lin.showActionSheet = (options={}) => { - const { - itemList = config.itemList, - success = config.success, - fail = config.fail, - title = config.title, - locked = config.locked, - cancelText = config.cancelText, - showCancel = config.showCancel, - } = options; - this.setData({ - itemList: itemList.slice(0, 10), - success, - fail, - title, - locked, - cancelText, - showCancel, - show: true, - }); - return this; - }; - }, - handleClickItem(e) { - const { - success - } = this.data; - success && success({ ...e.currentTarget.dataset }); - this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); - this._hideActionSheet(); - }, + initUIAdapter() { + wx.getSystemInfo({ + success: (res) => { + this.setData({ + isIphoneX: res.model == 'iPhone X' ? true : false, + }); + } + }); + }, + initActionSheet() { + const config = { + itemList: [], + success: null, + fail: null, + title: '', + locked: true, + cancelText: '取消', + showCancel: false + }; + wx.lin = wx.lin || {}; + wx.lin.showActionSheet = (options={}) => { + const { + itemList = config.itemList, + success = config.success, + fail = config.fail, + title = config.title, + locked = config.locked, + cancelText = config.cancelText, + showCancel = config.showCancel, + } = options; + this.setData({ + itemList: itemList.slice(0, 10), + success, + fail, + title, + locked, + cancelText, + showCancel, + show: true, + }); + return this; + }; + }, + handleClickItem(e) { + const { + success + } = this.data; + success && success({ ...e.currentTarget.dataset }); + this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); + this._hideActionSheet(); + }, - _showActionSheet() { - this.setData({ - show: true - }) - }, + _showActionSheet() { + this.setData({ + show: true + }); + }, - _hideActionSheet() { - this.setData({ - show: false - }) - }, + _hideActionSheet() { + this.setData({ + show: false + }); + }, - handleClickCancel() { - const { - fail - } = this.data; - fail && fail({ - errMsg: 'showactionsheet:fail cancel' - }); - this.triggerEvent('lincancel', { - errMsg: 'showactionsheet:fail cancel' - }) - this._hideActionSheet(); - }, + handleClickCancel() { + const { + fail + } = this.data; + fail && fail({ + errMsg: 'showactionsheet:fail cancel' + }); + this.triggerEvent('lincancel', { + errMsg: 'showactionsheet:fail cancel' + }); + this._hideActionSheet(); + }, - handleClickPopUp() { - if (!this.data.locked) { - this.handleClickCancel(); - } - }, - } + handleClickPopUp() { + if (!this.data.locked) { + this.handleClickCancel(); + } + }, + } }); \ No newline at end of file diff --git a/dist/avatar/index.js b/dist/avatar/index.js index bf38e55b..629491aa 100644 --- a/dist/avatar/index.js +++ b/dist/avatar/index.js @@ -1,86 +1,86 @@ Component({ - externalClasses: ['l-class', 'l-class-text'], - properties: { - icon: String, - text: String, - iconStyle: { - type: String, - observer: '_parseCSSText' - }, - src: String, - openData: { - type: Array, - observer: '_initOpenData' - }, - shape: { - type: String, - value: 'circle' - }, - mode: { - type: String, - value: 'scaleToFill' - }, - size: { - type: Number, - value: 120, - }, - placement: { - type: String, - value: 'right' - }, + externalClasses: ['l-class', 'l-class-text'], + properties: { + icon: String, + text: String, + iconStyle: { + type: String, + observer: '_parseCSSText' }, - data: { - _isHaveUserNickName: false, - _isHaveUserAvatarUrl: false, - _iconSize: '', - _iconColor: '#ffffff' + src: String, + openData: { + type: Array, + observer: '_initOpenData' }, - methods: { - _initOpenData: function (openData) { - this._isHaveUserAvatarUrl(openData); - this._isHaveUserNickName(openData); - }, - _parseCSSText: function parseCSSText(cssText) { - var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', " ").replace('/\s+/g', " "); - var style = {}; - var properties = cssTxt.split(";").map(function (o) { - return o.split(":").map(function (x) { - return x && x.trim() - }); - }); - properties.forEach(function (property) { - var key = property[0]; - var value = property[1]; - style[key] = value; - }); + shape: { + type: String, + value: 'circle' + }, + mode: { + type: String, + value: 'scaleToFill' + }, + size: { + type: Number, + value: 120, + }, + placement: { + type: String, + value: 'right' + }, + }, + data: { + _isHaveUserNickName: false, + _isHaveUserAvatarUrl: false, + _iconSize: '', + _iconColor: '#ffffff' + }, + methods: { + _initOpenData: function (openData) { + this._isHaveUserAvatarUrl(openData); + this._isHaveUserNickName(openData); + }, + _parseCSSText: function parseCSSText(cssText) { + var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', ' ').replace('/\s+/g', ' '); + var style = {}; + var properties = cssTxt.split(';').map(function (o) { + return o.split(':').map(function (x) { + return x && x.trim(); + }); + }); + properties.forEach(function (property) { + var key = property[0]; + var value = property[1]; + style[key] = value; + }); - this.setData({ - _iconSize: style.size || this.data.size * 0.6, - _iconColor: style.color || '#ffffff', - }) - }, - _isHaveUserAvatarUrl: function (openData) { - this.setData({ - _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 - }) - }, + this.setData({ + _iconSize: style.size || this.data.size * 0.6, + _iconColor: style.color || '#ffffff', + }); + }, + _isHaveUserAvatarUrl: function (openData) { + this.setData({ + _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 + }); + }, - _isHaveUserNickName: function (openData) { - this.setData({ - _isHaveUserNickName: openData.indexOf('userNickName') !== -1 - }) - }, - tapAvatar: function (e) { - this.triggerEvent('lintap', { - e - }, { - bubbles: false - }); - this.triggerEvent('lintapcatch', { - e - }, { - bubbles: true - }); - }, - } + _isHaveUserNickName: function (openData) { + this.setData({ + _isHaveUserNickName: openData.indexOf('userNickName') !== -1 + }); + }, + tapAvatar: function (e) { + this.triggerEvent('lintap', { + e + }, { + bubbles: false + }); + this.triggerEvent('lintapcatch', { + e + }, { + bubbles: true + }); + }, + } }); \ No newline at end of file diff --git a/dist/button/index.js b/dist/button/index.js index e472bdbe..dfb4f0e2 100644 --- a/dist/button/index.js +++ b/dist/button/index.js @@ -1,79 +1,79 @@ Component({ - externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], - properties: { - // button组建标识 - name: { - type: String, - value: 'lin' - }, - type: { - type: String, - value: 'default', - }, - plain: Boolean, - size: { - type: String, - value: 'medium', - }, - shape: { - type: String, - value: 'circle', - }, - disabled: { - type: Boolean, - value: false, - }, - special: { - type: Boolean, - value: false, - }, - loading: { - type: Boolean, - value: false, - }, - // 微信原生接口 - width:Number, - height:Number, - icon: String, - image: String, - iconStyle: { - type: String, - value: 'size:20;color:#3683D6' - }, - iconColor: String, - iconSize: String, - openType: String, - appParameter: String, - lang: String, - hoverStopPropagation: Boolean, - hoverStartTime: { - type: Number, - value: 20 - }, - hoverStayTime: { - type: Number, - value: 70 - }, - sessionFrom: { - type: String, - value: '' - }, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: Boolean, - formType: String + externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], + properties: { + // button组建标识 + name: { + type: String, + value: 'lin' }, - methods: { - // button点击事件 - handleTap() { - if (this.data.disabled) return false; - this.triggerEvent('lintap'); - this.triggerEvent('lintapcatch',{},{ bubbles: true }); - }, - // 开放能力事件回调 - openTypeEvent(data) { - this.triggerEvent(data.type, data.detail, {}); - } + type: { + type: String, + value: 'default', + }, + plain: Boolean, + size: { + type: String, + value: 'medium', + }, + shape: { + type: String, + value: 'circle', + }, + disabled: { + type: Boolean, + value: false, + }, + special: { + type: Boolean, + value: false, + }, + loading: { + type: Boolean, + value: false, + }, + // 微信原生接口 + width:Number, + height:Number, + icon: String, + image: String, + iconStyle: { + type: String, + value: 'size:20;color:#3683D6' + }, + iconColor: String, + iconSize: String, + openType: String, + appParameter: String, + lang: String, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + formType: String + }, + methods: { + // button点击事件 + handleTap() { + if (this.data.disabled) return false; + this.triggerEvent('lintap'); + this.triggerEvent('lintapcatch',{},{ bubbles: true }); + }, + // 开放能力事件回调 + openTypeEvent(data) { + this.triggerEvent(data.type, data.detail, {}); } - }); + } +}); diff --git a/dist/button/index.wxss b/dist/button/index.wxss index 0938a598..da04df64 100644 --- a/dist/button/index.wxss +++ b/dist/button/index.wxss @@ -1 +1 @@ -.btn-hover{opacity:.8}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:750rpx}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file +.btn-hover{opacity:.8}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:100%}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file diff --git a/dist/card/index.wxss b/dist/card/index.wxss index 9de79836..f4f948a6 100644 --- a/dist/card/index.wxss +++ b/dist/card/index.wxss @@ -1 +1 @@ -.card-container{margin:0 auto;padding:30rpx;box-sizing:border-box;background:#fff;display:flex}.card-container-full{width:750rpx}.card-container-unfull{width:690rpx;box-shadow:0 4rpx 20rpx 0 rgba(212,217,223,.5);border-radius:4px}.card-container-primary-left{flex-direction:row}.card-container-primary-right{flex-direction:row-reverse}.card-container-avatar{flex-direction:column}.card-container-cover{flex-direction:column}.cover-img-full{width:690rpx;height:260rpx}.cover-img-unfull{width:630rpx;height:260rpx}.card-img-primary{height:240rpx;width:240rpx;overflow:hidden}.card-img-primary-left{margin-right:40rpx}.card-img-primary-right{margin-left:40rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-content{position:relative;display:flex;flex-direction:column;flex:1}.card-title{overflow:hidden;text-overflow:ellipsis;color:#333}.card-title-primary{font-size:32rpx;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.card-title-avatar{font-size:28rpx}.card-title-cover{font-size:30rpx;margin-top:10rpx}.card-title-avatar{font-size:28rpx}.card-avatar-top{display:flex;flex-direction:row;height:100rpx;align-items:center;justify-content:space-between}.card-avatar-left{display:flex;flex-direction:row;align-items:center}.card-avatar{display:flex;flex-direction:column}.describe{color:#666;font-size:24rpx} \ No newline at end of file +.card-container{margin:0 auto;padding:30rpx;box-sizing:border-box;background:#fff;display:flex}.card-container-full{width:100%}.card-container-unfull{width:92%;box-shadow:0 4rpx 20rpx 0 rgba(212,217,223,.5);border-radius:4px}.card-container-primary-left{flex-direction:row}.card-container-primary-right{flex-direction:row-reverse}.card-container-avatar{flex-direction:column}.card-container-cover{flex-direction:column}.cover-img-full{width:100%;height:260rpx}.cover-img-unfull{width:100%;height:260rpx}.card-img-primary{height:240rpx;width:240rpx;overflow:hidden}.card-img-primary-left{margin-right:40rpx}.card-img-primary-right{margin-left:40rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-content{position:relative;display:flex;flex-direction:column;flex:1}.card-title{overflow:hidden;text-overflow:ellipsis;color:#333}.card-title-primary{font-size:32rpx;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.card-title-avatar{font-size:28rpx}.card-title-cover{font-size:30rpx;margin-top:10rpx}.card-title-avatar{font-size:28rpx}.card-avatar-top{display:flex;flex-direction:row;height:100rpx;align-items:center;justify-content:space-between}.card-avatar-left{display:flex;flex-direction:row;align-items:center}.card-avatar{display:flex;flex-direction:column}.describe{color:#666;font-size:24rpx} \ No newline at end of file diff --git a/dist/combined-tabs/index.js b/dist/combined-tabs/index.js index 38827148..3c2075d3 100644 --- a/dist/combined-tabs/index.js +++ b/dist/combined-tabs/index.js @@ -257,7 +257,7 @@ Component({ const query = wx.createSelectorQuery().in(this); query.select(selector).boundingClientRect((res) => { if (!res) return reject('找不到元素'); - resolve(res) + resolve(res); }).exec(); }); } diff --git a/dist/price/index.js b/dist/price/index.js index 5881c5e4..ab4bb540 100644 --- a/dist/price/index.js +++ b/dist/price/index.js @@ -1,9 +1,8 @@ - Component({ /** * 组件的属性列表 */ - externalClasses: ['l-class','l-unit-class', 'l-count-class'], + externalClasses: ['l-class', 'l-unit-class', 'l-count-class'], options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, @@ -26,7 +25,8 @@ Component({ }, count: { type: Number, - value: 0.00 + value: 0.00, + observer: 'reserveNumber' }, countColor: { type: String, @@ -45,6 +45,11 @@ Component({ type: String, value: '#777' }, + reserveDigit: { + type: Number, + value: 2 + }, + autofix: Boolean }, /** @@ -58,6 +63,29 @@ Component({ * 组件的方法列表 */ methods: { - + reserveNumber(value) { + const strValue = value.toString(); + const dotIndex = strValue.indexOf('.'); + if (strValue.length - dotIndex - 1 > this.data.reserveDigit && dotIndex !== -1) { + this.setData({ + result: strValue.substring(0, dotIndex + this.data.reserveDigit) + }); + } else { + this.addZero(strValue); + } + }, + addZero(value) { + const realLen = value.indexOf('.') + 1 + this.data.reserveDigit; + if (value.length < realLen && this.data.autofix) { + const result = value + '0'.repeat(realLen - value.length); + this.setData({ + result + }); + } else { + this.setData({ + result: value + }); + } + } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/dist/price/index.wxml b/dist/price/index.wxml index fb41b47b..e35de0c8 100644 --- a/dist/price/index.wxml +++ b/dist/price/index.wxml @@ -3,6 +3,6 @@ {{unit}} - {{count}} + {{result}} \ No newline at end of file diff --git a/dist/step/index.js b/dist/step/index.js index 4d1918f3..edda0564 100755 --- a/dist/step/index.js +++ b/dist/step/index.js @@ -45,7 +45,7 @@ Component({ updateDataChange(options) { this.setData({ ...options - }) + }); } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/dist/steps/index.js b/dist/steps/index.js index bb608e17..f094183c 100755 --- a/dist/steps/index.js +++ b/dist/steps/index.js @@ -52,11 +52,11 @@ Component({ */ methods: { _initSteps() { - let steps = this.getRelationNodes('../step/index') - let length = steps.length + let steps = this.getRelationNodes('../step/index'); + let length = steps.length; if (this.data.direction == 'row') this.setData({ length - }) + }); if (length > 0) { steps.forEach((step, index) => { step.updateDataChange({ @@ -68,4 +68,4 @@ Component({ } } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/dist/tag/index.js b/dist/tag/index.js index 984b0563..ce9ce0b2 100644 --- a/dist/tag/index.js +++ b/dist/tag/index.js @@ -47,7 +47,7 @@ Component({ let options = { name: this.properties.name, select: this.properties.select - } + }; this.triggerEvent('lintap', options, {}); this.triggerEvent('lintapcatch', options, { bubbles: true diff --git a/examples/dist/action-sheet/index.js b/examples/dist/action-sheet/index.js index 616649e3..52446edd 100644 --- a/examples/dist/action-sheet/index.js +++ b/examples/dist/action-sheet/index.js @@ -1,125 +1,125 @@ Component({ - externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel'], - properties: { - locked: Boolean, - showCancel: Boolean, - show: Boolean, - itemList: Array, - cancelText: { - type: String, - value: '取消' - }, - title: String, - openApi: { - type: Boolean, - value: true, - } - }, - data: { - success: '', - fail: '', - isIphoneX: false - }, - attached() { - if (this.data.openApi) { - this.initActionSheet(); - } - this.initUIAdapter(); + externalClasses: ['l-class-title', 'l-class-item', 'l-class-cancel'], + properties: { + locked: Boolean, + showCancel: Boolean, + show: Boolean, + itemList: Array, + cancelText: { + type: String, + value: '取消' }, + title: String, + openApi: { + type: Boolean, + value: true, + } + }, + data: { + success: '', + fail: '', + isIphoneX: false + }, + attached() { + if (this.data.openApi) { + this.initActionSheet(); + } + this.initUIAdapter(); + }, - lifetimes: { - show() { - if (this.data.openApi) { - this.initActionSheet(); - } + lifetimes: { + show() { + if (this.data.openApi) { + this.initActionSheet(); + } - }, }, - methods: { - /** + }, + methods: { + /** * 区分UI尺寸 */ - initUIAdapter() { - wx.getSystemInfo({ - success: (res) => { - this.setData({ - isIphoneX: res.model == "iPhone X" ? true : false, - }) - } - }) - }, - initActionSheet() { - const config = { - itemList: [], - success: null, - fail: null, - title: '', - locked: true, - cancelText: '取消', - showCancel: false - } - wx.lin = wx.lin || {}; - wx.lin.showActionSheet = (options={}) => { - const { - itemList = config.itemList, - success = config.success, - fail = config.fail, - title = config.title, - locked = config.locked, - cancelText = config.cancelText, - showCancel = config.showCancel, - } = options; - this.setData({ - itemList: itemList.slice(0, 10), - success, - fail, - title, - locked, - cancelText, - showCancel, - show: true, - }); - return this; - }; - }, - handleClickItem(e) { - const { - success - } = this.data; - success && success({ ...e.currentTarget.dataset }); - this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); - this._hideActionSheet(); - }, + initUIAdapter() { + wx.getSystemInfo({ + success: (res) => { + this.setData({ + isIphoneX: res.model == 'iPhone X' ? true : false, + }); + } + }); + }, + initActionSheet() { + const config = { + itemList: [], + success: null, + fail: null, + title: '', + locked: true, + cancelText: '取消', + showCancel: false + }; + wx.lin = wx.lin || {}; + wx.lin.showActionSheet = (options={}) => { + const { + itemList = config.itemList, + success = config.success, + fail = config.fail, + title = config.title, + locked = config.locked, + cancelText = config.cancelText, + showCancel = config.showCancel, + } = options; + this.setData({ + itemList: itemList.slice(0, 10), + success, + fail, + title, + locked, + cancelText, + showCancel, + show: true, + }); + return this; + }; + }, + handleClickItem(e) { + const { + success + } = this.data; + success && success({ ...e.currentTarget.dataset }); + this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); + this._hideActionSheet(); + }, - _showActionSheet() { - this.setData({ - show: true - }) - }, + _showActionSheet() { + this.setData({ + show: true + }); + }, - _hideActionSheet() { - this.setData({ - show: false - }) - }, + _hideActionSheet() { + this.setData({ + show: false + }); + }, - handleClickCancel() { - const { - fail - } = this.data; - fail && fail({ - errMsg: 'showactionsheet:fail cancel' - }); - this.triggerEvent('lincancel', { - errMsg: 'showactionsheet:fail cancel' - }) - this._hideActionSheet(); - }, + handleClickCancel() { + const { + fail + } = this.data; + fail && fail({ + errMsg: 'showactionsheet:fail cancel' + }); + this.triggerEvent('lincancel', { + errMsg: 'showactionsheet:fail cancel' + }); + this._hideActionSheet(); + }, - handleClickPopUp() { - if (!this.data.locked) { - this.handleClickCancel(); - } - }, - } + handleClickPopUp() { + if (!this.data.locked) { + this.handleClickCancel(); + } + }, + } }); \ No newline at end of file diff --git a/examples/dist/avatar/index.js b/examples/dist/avatar/index.js index bf38e55b..629491aa 100644 --- a/examples/dist/avatar/index.js +++ b/examples/dist/avatar/index.js @@ -1,86 +1,86 @@ Component({ - externalClasses: ['l-class', 'l-class-text'], - properties: { - icon: String, - text: String, - iconStyle: { - type: String, - observer: '_parseCSSText' - }, - src: String, - openData: { - type: Array, - observer: '_initOpenData' - }, - shape: { - type: String, - value: 'circle' - }, - mode: { - type: String, - value: 'scaleToFill' - }, - size: { - type: Number, - value: 120, - }, - placement: { - type: String, - value: 'right' - }, + externalClasses: ['l-class', 'l-class-text'], + properties: { + icon: String, + text: String, + iconStyle: { + type: String, + observer: '_parseCSSText' }, - data: { - _isHaveUserNickName: false, - _isHaveUserAvatarUrl: false, - _iconSize: '', - _iconColor: '#ffffff' + src: String, + openData: { + type: Array, + observer: '_initOpenData' }, - methods: { - _initOpenData: function (openData) { - this._isHaveUserAvatarUrl(openData); - this._isHaveUserNickName(openData); - }, - _parseCSSText: function parseCSSText(cssText) { - var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', " ").replace('/\s+/g', " "); - var style = {}; - var properties = cssTxt.split(";").map(function (o) { - return o.split(":").map(function (x) { - return x && x.trim() - }); - }); - properties.forEach(function (property) { - var key = property[0]; - var value = property[1]; - style[key] = value; - }); + shape: { + type: String, + value: 'circle' + }, + mode: { + type: String, + value: 'scaleToFill' + }, + size: { + type: Number, + value: 120, + }, + placement: { + type: String, + value: 'right' + }, + }, + data: { + _isHaveUserNickName: false, + _isHaveUserAvatarUrl: false, + _iconSize: '', + _iconColor: '#ffffff' + }, + methods: { + _initOpenData: function (openData) { + this._isHaveUserAvatarUrl(openData); + this._isHaveUserNickName(openData); + }, + _parseCSSText: function parseCSSText(cssText) { + var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', ' ').replace('/\s+/g', ' '); + var style = {}; + var properties = cssTxt.split(';').map(function (o) { + return o.split(':').map(function (x) { + return x && x.trim(); + }); + }); + properties.forEach(function (property) { + var key = property[0]; + var value = property[1]; + style[key] = value; + }); - this.setData({ - _iconSize: style.size || this.data.size * 0.6, - _iconColor: style.color || '#ffffff', - }) - }, - _isHaveUserAvatarUrl: function (openData) { - this.setData({ - _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 - }) - }, + this.setData({ + _iconSize: style.size || this.data.size * 0.6, + _iconColor: style.color || '#ffffff', + }); + }, + _isHaveUserAvatarUrl: function (openData) { + this.setData({ + _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 + }); + }, - _isHaveUserNickName: function (openData) { - this.setData({ - _isHaveUserNickName: openData.indexOf('userNickName') !== -1 - }) - }, - tapAvatar: function (e) { - this.triggerEvent('lintap', { - e - }, { - bubbles: false - }); - this.triggerEvent('lintapcatch', { - e - }, { - bubbles: true - }); - }, - } + _isHaveUserNickName: function (openData) { + this.setData({ + _isHaveUserNickName: openData.indexOf('userNickName') !== -1 + }); + }, + tapAvatar: function (e) { + this.triggerEvent('lintap', { + e + }, { + bubbles: false + }); + this.triggerEvent('lintapcatch', { + e + }, { + bubbles: true + }); + }, + } }); \ No newline at end of file diff --git a/examples/dist/button/index.js b/examples/dist/button/index.js index e472bdbe..dfb4f0e2 100644 --- a/examples/dist/button/index.js +++ b/examples/dist/button/index.js @@ -1,79 +1,79 @@ Component({ - externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], - properties: { - // button组建标识 - name: { - type: String, - value: 'lin' - }, - type: { - type: String, - value: 'default', - }, - plain: Boolean, - size: { - type: String, - value: 'medium', - }, - shape: { - type: String, - value: 'circle', - }, - disabled: { - type: Boolean, - value: false, - }, - special: { - type: Boolean, - value: false, - }, - loading: { - type: Boolean, - value: false, - }, - // 微信原生接口 - width:Number, - height:Number, - icon: String, - image: String, - iconStyle: { - type: String, - value: 'size:20;color:#3683D6' - }, - iconColor: String, - iconSize: String, - openType: String, - appParameter: String, - lang: String, - hoverStopPropagation: Boolean, - hoverStartTime: { - type: Number, - value: 20 - }, - hoverStayTime: { - type: Number, - value: 70 - }, - sessionFrom: { - type: String, - value: '' - }, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: Boolean, - formType: String + externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], + properties: { + // button组建标识 + name: { + type: String, + value: 'lin' }, - methods: { - // button点击事件 - handleTap() { - if (this.data.disabled) return false; - this.triggerEvent('lintap'); - this.triggerEvent('lintapcatch',{},{ bubbles: true }); - }, - // 开放能力事件回调 - openTypeEvent(data) { - this.triggerEvent(data.type, data.detail, {}); - } + type: { + type: String, + value: 'default', + }, + plain: Boolean, + size: { + type: String, + value: 'medium', + }, + shape: { + type: String, + value: 'circle', + }, + disabled: { + type: Boolean, + value: false, + }, + special: { + type: Boolean, + value: false, + }, + loading: { + type: Boolean, + value: false, + }, + // 微信原生接口 + width:Number, + height:Number, + icon: String, + image: String, + iconStyle: { + type: String, + value: 'size:20;color:#3683D6' + }, + iconColor: String, + iconSize: String, + openType: String, + appParameter: String, + lang: String, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + formType: String + }, + methods: { + // button点击事件 + handleTap() { + if (this.data.disabled) return false; + this.triggerEvent('lintap'); + this.triggerEvent('lintapcatch',{},{ bubbles: true }); + }, + // 开放能力事件回调 + openTypeEvent(data) { + this.triggerEvent(data.type, data.detail, {}); } - }); + } +}); diff --git a/examples/dist/button/index.wxss b/examples/dist/button/index.wxss index 0938a598..da04df64 100644 --- a/examples/dist/button/index.wxss +++ b/examples/dist/button/index.wxss @@ -1 +1 @@ -.btn-hover{opacity:.8}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:750rpx}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file +.btn-hover{opacity:.8}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:100%}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file diff --git a/examples/dist/card/index.wxss b/examples/dist/card/index.wxss index 9de79836..f4f948a6 100644 --- a/examples/dist/card/index.wxss +++ b/examples/dist/card/index.wxss @@ -1 +1 @@ -.card-container{margin:0 auto;padding:30rpx;box-sizing:border-box;background:#fff;display:flex}.card-container-full{width:750rpx}.card-container-unfull{width:690rpx;box-shadow:0 4rpx 20rpx 0 rgba(212,217,223,.5);border-radius:4px}.card-container-primary-left{flex-direction:row}.card-container-primary-right{flex-direction:row-reverse}.card-container-avatar{flex-direction:column}.card-container-cover{flex-direction:column}.cover-img-full{width:690rpx;height:260rpx}.cover-img-unfull{width:630rpx;height:260rpx}.card-img-primary{height:240rpx;width:240rpx;overflow:hidden}.card-img-primary-left{margin-right:40rpx}.card-img-primary-right{margin-left:40rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-content{position:relative;display:flex;flex-direction:column;flex:1}.card-title{overflow:hidden;text-overflow:ellipsis;color:#333}.card-title-primary{font-size:32rpx;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.card-title-avatar{font-size:28rpx}.card-title-cover{font-size:30rpx;margin-top:10rpx}.card-title-avatar{font-size:28rpx}.card-avatar-top{display:flex;flex-direction:row;height:100rpx;align-items:center;justify-content:space-between}.card-avatar-left{display:flex;flex-direction:row;align-items:center}.card-avatar{display:flex;flex-direction:column}.describe{color:#666;font-size:24rpx} \ No newline at end of file +.card-container{margin:0 auto;padding:30rpx;box-sizing:border-box;background:#fff;display:flex}.card-container-full{width:100%}.card-container-unfull{width:92%;box-shadow:0 4rpx 20rpx 0 rgba(212,217,223,.5);border-radius:4px}.card-container-primary-left{flex-direction:row}.card-container-primary-right{flex-direction:row-reverse}.card-container-avatar{flex-direction:column}.card-container-cover{flex-direction:column}.cover-img-full{width:100%;height:260rpx}.cover-img-unfull{width:100%;height:260rpx}.card-img-primary{height:240rpx;width:240rpx;overflow:hidden}.card-img-primary-left{margin-right:40rpx}.card-img-primary-right{margin-left:40rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-img-avatar{height:60rpx;width:60rpx;border-radius:50%;margin-right:30rpx}.card-content{position:relative;display:flex;flex-direction:column;flex:1}.card-title{overflow:hidden;text-overflow:ellipsis;color:#333}.card-title-primary{font-size:32rpx;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.card-title-avatar{font-size:28rpx}.card-title-cover{font-size:30rpx;margin-top:10rpx}.card-title-avatar{font-size:28rpx}.card-avatar-top{display:flex;flex-direction:row;height:100rpx;align-items:center;justify-content:space-between}.card-avatar-left{display:flex;flex-direction:row;align-items:center}.card-avatar{display:flex;flex-direction:column}.describe{color:#666;font-size:24rpx} \ No newline at end of file diff --git a/examples/dist/combined-tabs/index.js b/examples/dist/combined-tabs/index.js index 38827148..3c2075d3 100644 --- a/examples/dist/combined-tabs/index.js +++ b/examples/dist/combined-tabs/index.js @@ -257,7 +257,7 @@ Component({ const query = wx.createSelectorQuery().in(this); query.select(selector).boundingClientRect((res) => { if (!res) return reject('找不到元素'); - resolve(res) + resolve(res); }).exec(); }); } diff --git a/examples/dist/price/index.js b/examples/dist/price/index.js index 5881c5e4..ab4bb540 100644 --- a/examples/dist/price/index.js +++ b/examples/dist/price/index.js @@ -1,9 +1,8 @@ - Component({ /** * 组件的属性列表 */ - externalClasses: ['l-class','l-unit-class', 'l-count-class'], + externalClasses: ['l-class', 'l-unit-class', 'l-count-class'], options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, @@ -26,7 +25,8 @@ Component({ }, count: { type: Number, - value: 0.00 + value: 0.00, + observer: 'reserveNumber' }, countColor: { type: String, @@ -45,6 +45,11 @@ Component({ type: String, value: '#777' }, + reserveDigit: { + type: Number, + value: 2 + }, + autofix: Boolean }, /** @@ -58,6 +63,29 @@ Component({ * 组件的方法列表 */ methods: { - + reserveNumber(value) { + const strValue = value.toString(); + const dotIndex = strValue.indexOf('.'); + if (strValue.length - dotIndex - 1 > this.data.reserveDigit && dotIndex !== -1) { + this.setData({ + result: strValue.substring(0, dotIndex + this.data.reserveDigit) + }); + } else { + this.addZero(strValue); + } + }, + addZero(value) { + const realLen = value.indexOf('.') + 1 + this.data.reserveDigit; + if (value.length < realLen && this.data.autofix) { + const result = value + '0'.repeat(realLen - value.length); + this.setData({ + result + }); + } else { + this.setData({ + result: value + }); + } + } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/examples/dist/price/index.wxml b/examples/dist/price/index.wxml index fb41b47b..e35de0c8 100644 --- a/examples/dist/price/index.wxml +++ b/examples/dist/price/index.wxml @@ -3,6 +3,6 @@ {{unit}} - {{count}} + {{result}} \ No newline at end of file diff --git a/examples/dist/step/index.js b/examples/dist/step/index.js index 4d1918f3..edda0564 100755 --- a/examples/dist/step/index.js +++ b/examples/dist/step/index.js @@ -45,7 +45,7 @@ Component({ updateDataChange(options) { this.setData({ ...options - }) + }); } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/examples/dist/steps/index.js b/examples/dist/steps/index.js index bb608e17..f094183c 100755 --- a/examples/dist/steps/index.js +++ b/examples/dist/steps/index.js @@ -52,11 +52,11 @@ Component({ */ methods: { _initSteps() { - let steps = this.getRelationNodes('../step/index') - let length = steps.length + let steps = this.getRelationNodes('../step/index'); + let length = steps.length; if (this.data.direction == 'row') this.setData({ length - }) + }); if (length > 0) { steps.forEach((step, index) => { step.updateDataChange({ @@ -68,4 +68,4 @@ Component({ } } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/examples/dist/tag/index.js b/examples/dist/tag/index.js index 984b0563..ce9ce0b2 100644 --- a/examples/dist/tag/index.js +++ b/examples/dist/tag/index.js @@ -47,7 +47,7 @@ Component({ let options = { name: this.properties.name, select: this.properties.select - } + }; this.triggerEvent('lintap', options, {}); this.triggerEvent('lintapcatch', options, { bubbles: true diff --git a/examples/pages/about/index.wxml b/examples/pages/about/index.wxml index 31cc7ac8..285c3d56 100644 --- a/examples/pages/about/index.wxml +++ b/examples/pages/about/index.wxml @@ -2,7 +2,7 @@ - 组件库版本号:v{{version}} + 版本号:v{{version}} diff --git a/examples/pages/about/index.wxss b/examples/pages/about/index.wxss index 4a4aeb53..9c88f71d 100644 --- a/examples/pages/about/index.wxss +++ b/examples/pages/about/index.wxss @@ -65,7 +65,7 @@ page { } .version { - font-size: 30rpx; + font-size: 28rpx; color: #3963bc; margin-top: 20rpx; } diff --git a/examples/pages/components/basic/pages/button/index.wxml b/examples/pages/components/basic/pages/button/index.wxml index a215d213..7cdccbe5 100644 --- a/examples/pages/components/basic/pages/button/index.wxml +++ b/examples/pages/components/basic/pages/button/index.wxml @@ -36,11 +36,11 @@ 大按钮 - - 通栏按钮 - + + 通栏按钮 + diff --git a/examples/pages/components/layout/pages/card/index.wxml b/examples/pages/components/layout/pages/card/index.wxml index 54641aea..877aaeb4 100644 --- a/examples/pages/components/layout/pages/card/index.wxml +++ b/examples/pages/components/layout/pages/card/index.wxml @@ -12,7 +12,7 @@ - + 卡片类型(cover) @@ -44,11 +44,7 @@ 10评论 - + 关注 + + 关注 @@ -86,9 +82,9 @@ 通栏卡片 - - + 大雄要死掉了,他对妻子说:我死之后你找一个男人我就在地下打一一个滚。说完就咽气了。某天... diff --git a/examples/pages/components/layout/pages/card/index.wxss b/examples/pages/components/layout/pages/card/index.wxss index 26925b5f..0da1b1d5 100644 --- a/examples/pages/components/layout/pages/card/index.wxss +++ b/examples/pages/components/layout/pages/card/index.wxss @@ -72,4 +72,4 @@ color: #666; font-size: 24rpx; margin-left: 12rpx; -} +} \ No newline at end of file diff --git a/examples/pages/components/shopping/pages/price/index.wxml b/examples/pages/components/shopping/pages/price/index.wxml index a6b536b3..ed8d7585 100644 --- a/examples/pages/components/shopping/pages/price/index.wxml +++ b/examples/pages/components/shopping/pages/price/index.wxml @@ -24,7 +24,8 @@ { - this.setData({ - isIphoneX: res.model == "iPhone X" ? true : false, - }) - } - }) - }, - initActionSheet() { - const config = { - itemList: [], - success: null, - fail: null, - title: '', - locked: true, - cancelText: '取消', - showCancel: false - } - wx.lin = wx.lin || {}; - wx.lin.showActionSheet = (options={}) => { - const { - itemList = config.itemList, - success = config.success, - fail = config.fail, - title = config.title, - locked = config.locked, - cancelText = config.cancelText, - showCancel = config.showCancel, - } = options; - this.setData({ - itemList: itemList.slice(0, 10), - success, - fail, - title, - locked, - cancelText, - showCancel, - show: true, - }); - return this; - }; - }, - handleClickItem(e) { - const { - success - } = this.data; - success && success({ ...e.currentTarget.dataset }); - this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); - this._hideActionSheet(); - }, + initUIAdapter() { + wx.getSystemInfo({ + success: (res) => { + this.setData({ + isIphoneX: res.model == 'iPhone X' ? true : false, + }); + } + }); + }, + initActionSheet() { + const config = { + itemList: [], + success: null, + fail: null, + title: '', + locked: true, + cancelText: '取消', + showCancel: false + }; + wx.lin = wx.lin || {}; + wx.lin.showActionSheet = (options={}) => { + const { + itemList = config.itemList, + success = config.success, + fail = config.fail, + title = config.title, + locked = config.locked, + cancelText = config.cancelText, + showCancel = config.showCancel, + } = options; + this.setData({ + itemList: itemList.slice(0, 10), + success, + fail, + title, + locked, + cancelText, + showCancel, + show: true, + }); + return this; + }; + }, + handleClickItem(e) { + const { + success + } = this.data; + success && success({ ...e.currentTarget.dataset }); + this.triggerEvent('linitemtap', { ...e.currentTarget.dataset }); + this._hideActionSheet(); + }, - _showActionSheet() { - this.setData({ - show: true - }) - }, + _showActionSheet() { + this.setData({ + show: true + }); + }, - _hideActionSheet() { - this.setData({ - show: false - }) - }, + _hideActionSheet() { + this.setData({ + show: false + }); + }, - handleClickCancel() { - const { - fail - } = this.data; - fail && fail({ - errMsg: 'showactionsheet:fail cancel' - }); - this.triggerEvent('lincancel', { - errMsg: 'showactionsheet:fail cancel' - }) - this._hideActionSheet(); - }, + handleClickCancel() { + const { + fail + } = this.data; + fail && fail({ + errMsg: 'showactionsheet:fail cancel' + }); + this.triggerEvent('lincancel', { + errMsg: 'showactionsheet:fail cancel' + }); + this._hideActionSheet(); + }, - handleClickPopUp() { - if (!this.data.locked) { - this.handleClickCancel(); - } - }, - } + handleClickPopUp() { + if (!this.data.locked) { + this.handleClickCancel(); + } + }, + } }); \ No newline at end of file diff --git a/src/avatar/index.js b/src/avatar/index.js index bf38e55b..629491aa 100644 --- a/src/avatar/index.js +++ b/src/avatar/index.js @@ -1,86 +1,86 @@ Component({ - externalClasses: ['l-class', 'l-class-text'], - properties: { - icon: String, - text: String, - iconStyle: { - type: String, - observer: '_parseCSSText' - }, - src: String, - openData: { - type: Array, - observer: '_initOpenData' - }, - shape: { - type: String, - value: 'circle' - }, - mode: { - type: String, - value: 'scaleToFill' - }, - size: { - type: Number, - value: 120, - }, - placement: { - type: String, - value: 'right' - }, + externalClasses: ['l-class', 'l-class-text'], + properties: { + icon: String, + text: String, + iconStyle: { + type: String, + observer: '_parseCSSText' }, - data: { - _isHaveUserNickName: false, - _isHaveUserAvatarUrl: false, - _iconSize: '', - _iconColor: '#ffffff' + src: String, + openData: { + type: Array, + observer: '_initOpenData' }, - methods: { - _initOpenData: function (openData) { - this._isHaveUserAvatarUrl(openData); - this._isHaveUserNickName(openData); - }, - _parseCSSText: function parseCSSText(cssText) { - var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', " ").replace('/\s+/g', " "); - var style = {}; - var properties = cssTxt.split(";").map(function (o) { - return o.split(":").map(function (x) { - return x && x.trim() - }); - }); - properties.forEach(function (property) { - var key = property[0]; - var value = property[1]; - style[key] = value; - }); + shape: { + type: String, + value: 'circle' + }, + mode: { + type: String, + value: 'scaleToFill' + }, + size: { + type: Number, + value: 120, + }, + placement: { + type: String, + value: 'right' + }, + }, + data: { + _isHaveUserNickName: false, + _isHaveUserAvatarUrl: false, + _iconSize: '', + _iconColor: '#ffffff' + }, + methods: { + _initOpenData: function (openData) { + this._isHaveUserAvatarUrl(openData); + this._isHaveUserNickName(openData); + }, + _parseCSSText: function parseCSSText(cssText) { + var cssTxt = cssText.replace('/\/\*(.|\s)*?\*\//g', ' ').replace('/\s+/g', ' '); + var style = {}; + var properties = cssTxt.split(';').map(function (o) { + return o.split(':').map(function (x) { + return x && x.trim(); + }); + }); + properties.forEach(function (property) { + var key = property[0]; + var value = property[1]; + style[key] = value; + }); - this.setData({ - _iconSize: style.size || this.data.size * 0.6, - _iconColor: style.color || '#ffffff', - }) - }, - _isHaveUserAvatarUrl: function (openData) { - this.setData({ - _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 - }) - }, + this.setData({ + _iconSize: style.size || this.data.size * 0.6, + _iconColor: style.color || '#ffffff', + }); + }, + _isHaveUserAvatarUrl: function (openData) { + this.setData({ + _isHaveUserAvatarUrl: openData.indexOf('userAvatarUrl') !== -1 + }); + }, - _isHaveUserNickName: function (openData) { - this.setData({ - _isHaveUserNickName: openData.indexOf('userNickName') !== -1 - }) - }, - tapAvatar: function (e) { - this.triggerEvent('lintap', { - e - }, { - bubbles: false - }); - this.triggerEvent('lintapcatch', { - e - }, { - bubbles: true - }); - }, - } + _isHaveUserNickName: function (openData) { + this.setData({ + _isHaveUserNickName: openData.indexOf('userNickName') !== -1 + }); + }, + tapAvatar: function (e) { + this.triggerEvent('lintap', { + e + }, { + bubbles: false + }); + this.triggerEvent('lintapcatch', { + e + }, { + bubbles: true + }); + }, + } }); \ No newline at end of file diff --git a/src/button/index.js b/src/button/index.js index e472bdbe..dfb4f0e2 100644 --- a/src/button/index.js +++ b/src/button/index.js @@ -1,79 +1,79 @@ Component({ - externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], - properties: { - // button组建标识 - name: { - type: String, - value: 'lin' - }, - type: { - type: String, - value: 'default', - }, - plain: Boolean, - size: { - type: String, - value: 'medium', - }, - shape: { - type: String, - value: 'circle', - }, - disabled: { - type: Boolean, - value: false, - }, - special: { - type: Boolean, - value: false, - }, - loading: { - type: Boolean, - value: false, - }, - // 微信原生接口 - width:Number, - height:Number, - icon: String, - image: String, - iconStyle: { - type: String, - value: 'size:20;color:#3683D6' - }, - iconColor: String, - iconSize: String, - openType: String, - appParameter: String, - lang: String, - hoverStopPropagation: Boolean, - hoverStartTime: { - type: Number, - value: 20 - }, - hoverStayTime: { - type: Number, - value: 70 - }, - sessionFrom: { - type: String, - value: '' - }, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: Boolean, - formType: String + externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], + properties: { + // button组建标识 + name: { + type: String, + value: 'lin' }, - methods: { - // button点击事件 - handleTap() { - if (this.data.disabled) return false; - this.triggerEvent('lintap'); - this.triggerEvent('lintapcatch',{},{ bubbles: true }); - }, - // 开放能力事件回调 - openTypeEvent(data) { - this.triggerEvent(data.type, data.detail, {}); - } + type: { + type: String, + value: 'default', + }, + plain: Boolean, + size: { + type: String, + value: 'medium', + }, + shape: { + type: String, + value: 'circle', + }, + disabled: { + type: Boolean, + value: false, + }, + special: { + type: Boolean, + value: false, + }, + loading: { + type: Boolean, + value: false, + }, + // 微信原生接口 + width:Number, + height:Number, + icon: String, + image: String, + iconStyle: { + type: String, + value: 'size:20;color:#3683D6' + }, + iconColor: String, + iconSize: String, + openType: String, + appParameter: String, + lang: String, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean, + formType: String + }, + methods: { + // button点击事件 + handleTap() { + if (this.data.disabled) return false; + this.triggerEvent('lintap'); + this.triggerEvent('lintapcatch',{},{ bubbles: true }); + }, + // 开放能力事件回调 + openTypeEvent(data) { + this.triggerEvent(data.type, data.detail, {}); } - }); + } +}); diff --git a/src/button/index.less b/src/button/index.less index 50dc77cb..47316990 100644 --- a/src/button/index.less +++ b/src/button/index.less @@ -40,7 +40,7 @@ border-radius: 0; margin: 0; height: 88rpx; - width: 750rpx; + width: 100%; } &-medium{ height: @btn-height; diff --git a/src/card/index.less b/src/card/index.less index 45add6d0..01605729 100644 --- a/src/card/index.less +++ b/src/card/index.less @@ -6,11 +6,11 @@ display: flex; &-full{ - width: 750rpx; + width: 100%; } &-unfull{ - width: 690rpx; + width: 92%; box-shadow: 0 4rpx 20rpx 0 rgba(212, 217, 223, 0.5); border-radius: 4px; } @@ -34,12 +34,12 @@ .cover-img{ &-full{ - width: 690rpx; + width: 100%; height: 260rpx; } &-unfull{ - width: 630rpx; + width: 100%; height: 260rpx; } } diff --git a/src/combined-tabs/index.js b/src/combined-tabs/index.js index 38827148..3c2075d3 100644 --- a/src/combined-tabs/index.js +++ b/src/combined-tabs/index.js @@ -257,7 +257,7 @@ Component({ const query = wx.createSelectorQuery().in(this); query.select(selector).boundingClientRect((res) => { if (!res) return reject('找不到元素'); - resolve(res) + resolve(res); }).exec(); }); } diff --git a/src/price/index.js b/src/price/index.js index 5881c5e4..ab4bb540 100644 --- a/src/price/index.js +++ b/src/price/index.js @@ -1,9 +1,8 @@ - Component({ /** * 组件的属性列表 */ - externalClasses: ['l-class','l-unit-class', 'l-count-class'], + externalClasses: ['l-class', 'l-unit-class', 'l-count-class'], options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, @@ -26,7 +25,8 @@ Component({ }, count: { type: Number, - value: 0.00 + value: 0.00, + observer: 'reserveNumber' }, countColor: { type: String, @@ -45,6 +45,11 @@ Component({ type: String, value: '#777' }, + reserveDigit: { + type: Number, + value: 2 + }, + autofix: Boolean }, /** @@ -58,6 +63,29 @@ Component({ * 组件的方法列表 */ methods: { - + reserveNumber(value) { + const strValue = value.toString(); + const dotIndex = strValue.indexOf('.'); + if (strValue.length - dotIndex - 1 > this.data.reserveDigit && dotIndex !== -1) { + this.setData({ + result: strValue.substring(0, dotIndex + this.data.reserveDigit) + }); + } else { + this.addZero(strValue); + } + }, + addZero(value) { + const realLen = value.indexOf('.') + 1 + this.data.reserveDigit; + if (value.length < realLen && this.data.autofix) { + const result = value + '0'.repeat(realLen - value.length); + this.setData({ + result + }); + } else { + this.setData({ + result: value + }); + } + } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/src/price/index.wxml b/src/price/index.wxml index fb41b47b..e35de0c8 100644 --- a/src/price/index.wxml +++ b/src/price/index.wxml @@ -3,6 +3,6 @@ {{unit}} - {{count}} + {{result}} \ No newline at end of file diff --git a/src/step/index.js b/src/step/index.js index 4d1918f3..edda0564 100755 --- a/src/step/index.js +++ b/src/step/index.js @@ -45,7 +45,7 @@ Component({ updateDataChange(options) { this.setData({ ...options - }) + }); } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/src/steps/index.js b/src/steps/index.js index bb608e17..f094183c 100755 --- a/src/steps/index.js +++ b/src/steps/index.js @@ -52,11 +52,11 @@ Component({ */ methods: { _initSteps() { - let steps = this.getRelationNodes('../step/index') - let length = steps.length + let steps = this.getRelationNodes('../step/index'); + let length = steps.length; if (this.data.direction == 'row') this.setData({ length - }) + }); if (length > 0) { steps.forEach((step, index) => { step.updateDataChange({ @@ -68,4 +68,4 @@ Component({ } } } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/src/tag/index.js b/src/tag/index.js index 984b0563..ce9ce0b2 100644 --- a/src/tag/index.js +++ b/src/tag/index.js @@ -47,7 +47,7 @@ Component({ let options = { name: this.properties.name, select: this.properties.select - } + }; this.triggerEvent('lintap', options, {}); this.triggerEvent('lintapcatch', options, { bubbles: true