[build] 3.0.3

This commit is contained in:
pangxie1991 2018-05-21 22:02:47 +08:00
parent 9a4ceca7e1
commit bce357cfc0
3 changed files with 35 additions and 20 deletions

50
dist/cell/index.js vendored
View File

@ -48,29 +48,24 @@ Component({
isLastCell: true
},
methods: {
navigateTo() {
const { url = '' } = this.data;
const type = typeof this.data.isLink;
footerTap() {
// 如果并没有设置只点击 footer 生效那就不需要额外处理。cell 上有事件会自动处理
if (!this.data.onlyTapFooter) {
return;
}
this.triggerEvent('tap', {});
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
if (type !== 'boolean' && type !== 'string') {
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
return;
}
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
warn('linkType 属性可选值为 navigateToredirectToswitchTabreLaunch', this.data.linkType);
return;
}
wx[this.data.linkType].call(wx, { url });
doNavigate.call(this);
},
cellTap() {
if (!this.data.onlyTapFooter) {
this.navigateTo();
// 如果只点击 footer 生效,那就不需要在 cell 根节点上处理
if (this.data.onlyTapFooter) {
return;
}
this.triggerEvent('tap', {});
doNavigate.call(this);
},
// 用于被 cell-group 更新,标志是否是最后一个 cell
@ -79,3 +74,22 @@ Component({
}
}
});
// 处理跳转
function doNavigate() {
const { url = '' } = this.data;
const type = typeof this.data.isLink;
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
if (type !== 'boolean' && type !== 'string') {
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
return;
}
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
warn('linkType 属性可选值为 navigateToredirectToswitchTabreLaunch', this.data.linkType);
return;
}
wx[this.data.linkType].call(wx, { url });
}

View File

@ -1,5 +1,5 @@
<view
bindtap="cellTap"
catchtap="cellTap"
class="zan-cell {{ isLastCell ? 'last-cell' : '' }} {{ isLink ? 'zan-cell--access' : '' }}">
<view class="zan-cell__icon">
@ -12,7 +12,7 @@
<slot></slot>
</view>
<view catchtap="navigateTo" class="zan-cell__ft">
<view bindtap="footerTap" class="zan-cell__ft">
<block wx:if="{{value}}">{{ value }}</block>
<block wx:else>
<slot name="footer"></slot>

View File

@ -23,6 +23,7 @@
class="zan-dialog__button"
custom-class="{{ index === 0 ? 'zan-dialog__button-inside--first' : 'zan-dialog__button-inside' }}"
data-type="{{ item.type }}"
open-type="{{ item.openType }}"
bind:btnclick="handleButtonClick"
>
<view