mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-24 07:29:17 +08:00
[improvement] Dialog: optimize template (#729)
This commit is contained in:
parent
3c4e07093d
commit
43bf3a014a
@ -1,14 +1,39 @@
|
|||||||
<demo-block title="消息提示" padding>
|
<demo-block title="消息提示" padding>
|
||||||
<van-button type="primary" plain bind:click="onClickAlert" custom-class="demo-margin-right">消息提示</van-button>
|
<van-button
|
||||||
<van-button type="primary" plain bind:click="onClickAlert2">无标题提示</van-button>
|
plain
|
||||||
|
type="primary"
|
||||||
|
custom-class="demo-margin-right"
|
||||||
|
bind:click="onClickAlert"
|
||||||
|
>
|
||||||
|
消息提示
|
||||||
|
</van-button>
|
||||||
|
<van-button
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
bind:click="onClickAlert2"
|
||||||
|
>
|
||||||
|
无标题提示
|
||||||
|
</van-button>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="消息确认" padding>
|
<demo-block title="消息确认" padding>
|
||||||
<van-button type="primary" plain bind:click="onClickConfirm">消息确认</van-button>
|
<van-button
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
bind:click="onClickConfirm"
|
||||||
|
>
|
||||||
|
消息确认
|
||||||
|
</van-button>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="组件调用" padding>
|
<demo-block title="组件调用" padding>
|
||||||
<van-button type="danger" plain bind:click="showCustomDialog">组件调用</van-button>
|
<van-button
|
||||||
|
plain
|
||||||
|
type="danger"
|
||||||
|
bind:click="showCustomDialog"
|
||||||
|
>
|
||||||
|
组件调用
|
||||||
|
</van-button>
|
||||||
<van-dialog
|
<van-dialog
|
||||||
use-slot
|
use-slot
|
||||||
async-close
|
async-close
|
||||||
@ -27,7 +52,7 @@
|
|||||||
value="{{ password }}"
|
value="{{ password }}"
|
||||||
type="password"
|
type="password"
|
||||||
label="密码"
|
label="密码"
|
||||||
:border="false"
|
border="{{ false }}"
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
/>
|
/>
|
||||||
</van-dialog>
|
</van-dialog>
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<button
|
<button
|
||||||
class="custom-class van-button {{ classes }}"
|
|
||||||
id="{{ id }}"
|
id="{{ id }}"
|
||||||
|
lang="{{ lang }}"
|
||||||
|
class="custom-class van-button {{ classes }}"
|
||||||
open-type="{{ openType }}"
|
open-type="{{ openType }}"
|
||||||
app-parameter="{{ appParameter }}"
|
app-parameter="{{ appParameter }}"
|
||||||
hover-stop-propagation="{{ hoverStopPropagation }}"
|
|
||||||
hover-start-time="{{ hoverStartTime }}"
|
|
||||||
hover-stay-time="{{ hoverStayTime }}"
|
hover-stay-time="{{ hoverStayTime }}"
|
||||||
lang="{{ lang }}"
|
hover-start-time="{{ hoverStartTime }}"
|
||||||
|
hover-stop-propagation="{{ hoverStopPropagation }}"
|
||||||
session-from="{{ sessionFrom }}"
|
session-from="{{ sessionFrom }}"
|
||||||
send-message-title="{{ sendMessageTitle }}"
|
send-message-title="{{ sendMessageTitle }}"
|
||||||
send-message-path="{{ sendMessagePath }}"
|
send-message-path="{{ sendMessagePath }}"
|
||||||
send-message-img="{{ sendMessageImg }}"
|
send-message-img="{{ sendMessageImg }}"
|
||||||
show-message-card="{{ showMessageCard }}"
|
show-message-card="{{ showMessageCard }}"
|
||||||
bind:tap="onClick"
|
bind:tap="onClick"
|
||||||
|
binderror="bindError"
|
||||||
bindcontact="bindContact"
|
bindcontact="bindContact"
|
||||||
|
bindopensetting="bindOpenSetting"
|
||||||
bindgetuserinfo="bindGetUserInfo"
|
bindgetuserinfo="bindGetUserInfo"
|
||||||
bindgetphonenumber="bindGetPhoneNumber"
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
binderror="bindError"
|
|
||||||
bindopensetting="bindOpenSetting"
|
|
||||||
>
|
>
|
||||||
<van-loading
|
<van-loading
|
||||||
wx:if="{{ loading }}"
|
wx:if="{{ loading }}"
|
||||||
@ -25,5 +25,5 @@
|
|||||||
custom-class="loading-class"
|
custom-class="loading-class"
|
||||||
color="{{ type === 'default' ? '#c9c9c9' : '#fff' }}"
|
color="{{ type === 'default' ? '#c9c9c9' : '#fff' }}"
|
||||||
/>
|
/>
|
||||||
<slot wx:else></slot>
|
<slot wx:else />
|
||||||
</button>
|
</button>
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<view class="custom-class van-card {{ centered ? 'van-card--center' : '' }}">
|
<view class="custom-class van-card {{ centered ? 'van-card--center' : '' }}">
|
||||||
<view class="van-card__thumb" bind:tap="onClickThumb">
|
<view class="van-card__thumb" bind:tap="onClickThumb">
|
||||||
<image wx:if="{{ thumb }}" lazy-load="{{ lazyLoad }}" src="{{ thumb }}" class="van-card__img thumb-class" />
|
<image
|
||||||
|
wx:if="{{ thumb }}"
|
||||||
|
src="{{ thumb }}"
|
||||||
|
lazy-load="{{ lazyLoad }}"
|
||||||
|
class="van-card__img thumb-class"
|
||||||
|
/>
|
||||||
<slot wx:else name="thumb" />
|
<slot wx:else name="thumb" />
|
||||||
<van-tag
|
<van-tag
|
||||||
wx:if="{{ tag }}"
|
wx:if="{{ tag }}"
|
||||||
@ -11,19 +16,23 @@
|
|||||||
{{ tag }}
|
{{ tag }}
|
||||||
</van-tag>
|
</van-tag>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="van-card__content">
|
<view class="van-card__content">
|
||||||
<view wx:if="{{ title || price || price === 0 }}" class="van-card__row">
|
<view wx:if="{{ title || price || price === 0 }}" class="van-card__row">
|
||||||
<view wx:if="{{ title }}" class="van-card__title van-multi-ellipsis--l2 title-class">{{ title }}</view>
|
<view wx:if="{{ title }}" class="van-card__title van-multi-ellipsis--l2 title-class">{{ title }}</view>
|
||||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
||||||
</view>
|
</view>
|
||||||
<slot wx:else name="title" />
|
<slot wx:else name="title" />
|
||||||
|
|
||||||
<view wx:if="{{ desc || num }}" class="van-card__row">
|
<view wx:if="{{ desc || num }}" class="van-card__row">
|
||||||
<view wx:if="{{ desc }}" class="van-card__desc van-ellipsis desc-class">{{ desc }}</view>
|
<view wx:if="{{ desc }}" class="van-card__desc van-ellipsis desc-class">{{ desc }}</view>
|
||||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||||
</view>
|
</view>
|
||||||
<slot wx:else name="desc" />
|
<slot wx:else name="desc" />
|
||||||
|
|
||||||
<slot name="tags" />
|
<slot name="tags" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="van-card__footer">
|
<view class="van-card__footer">
|
||||||
<slot name="footer" />
|
<slot name="footer" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="van-cell__value value-class">
|
<view class="van-cell__value value-class">
|
||||||
<view wx:if="{{ value }}">{{ value }}</view>
|
<block wx:if="{{ value }}">{{ value }}</block>
|
||||||
<slot wx:else />
|
<slot wx:else />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
&__footer {
|
&__footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
|
||||||
user-select: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__button {
|
&__button {
|
||||||
|
@ -11,6 +11,7 @@ VantComponent({
|
|||||||
useSlot: Boolean,
|
useSlot: Boolean,
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
showCancelButton: Boolean,
|
showCancelButton: Boolean,
|
||||||
|
closeOnClickOverlay: Boolean,
|
||||||
confirmButtonOpenType: String,
|
confirmButtonOpenType: String,
|
||||||
zIndex: {
|
zIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -31,10 +32,6 @@ VantComponent({
|
|||||||
overlay: {
|
overlay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true
|
value: true
|
||||||
},
|
|
||||||
closeOnClickOverlay: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,48 +3,51 @@
|
|||||||
transition="scale"
|
transition="scale"
|
||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
|
||||||
custom-class="van-dialog"
|
custom-class="van-dialog"
|
||||||
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
bind:close="onClickOverlay"
|
bind:close="onClickOverlay"
|
||||||
>
|
>
|
||||||
<view wx:if="{{ title }}" class="van-dialog__header {{ !message && !useSlot ? 'van-dialog--isolated' : '' }}">
|
<view
|
||||||
|
wx:if="{{ title }}"
|
||||||
|
class="van-dialog__header {{ message || useSlot ? '' : 'van-dialog--isolated' }}"
|
||||||
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</view>
|
</view>
|
||||||
<view class="van-dialog__content" wx:if="{{ message || useSlot }}">
|
|
||||||
<slot wx:if="{{ useSlot }}" />
|
<slot wx:if="{{ useSlot }}" />
|
||||||
<view wx:elif="{{ message }}" class="van-dialog__message {{ title ? 'van-dialog__message--has-title' : '' }}">
|
<view
|
||||||
<text>{{ message }}</text>
|
wx:elif="{{ message }}"
|
||||||
</view>
|
class="van-dialog__message {{ title ? 'van-dialog__message--has-title' : '' }}"
|
||||||
|
>
|
||||||
|
<text>{{ message }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="van-hairline--top van-dialog__footer {{ showCancelButton && showConfirmButton ? 'van-dialog__footer--buttons' : '' }}">
|
|
||||||
<view wx:if="{{ showCancelButton }}" class="van-dialog__button">
|
<view class="van-hairline--top van-dialog__footer">
|
||||||
<van-button
|
<van-button
|
||||||
loading="{{ loading.cancel }}"
|
wx:if="{{ showCancelButton }}"
|
||||||
size="large"
|
size="large"
|
||||||
custom-class="van-dialog__cancel"
|
loading="{{ loading.cancel }}"
|
||||||
bind:click="onCancel"
|
class="van-dialog__button van-hairline--right"
|
||||||
>
|
custom-class="van-dialog__cancel"
|
||||||
{{ cancelButtonText }}
|
bind:click="onCancel"
|
||||||
</van-button>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
wx:if="{{ showConfirmButton }}"
|
|
||||||
class="van-dialog__button {{ showCancelButton ? 'van-hairline--left' : '' }}"
|
|
||||||
>
|
>
|
||||||
<van-button
|
{{ cancelButtonText }}
|
||||||
size="large"
|
</van-button>
|
||||||
loading="{{ loading.confirm }}"
|
<van-button
|
||||||
custom-class="van-dialog__confirm"
|
wx:if="{{ showConfirmButton }}"
|
||||||
open-type="{{ confirmButtonOpenType }}"
|
size="large"
|
||||||
bind:click="onConfirm"
|
class="van-dialog__button"
|
||||||
bindcontact="bindContact"
|
loading="{{ loading.confirm }}"
|
||||||
bindgetuserinfo="bindGetUserInfo"
|
custom-class="van-dialog__confirm"
|
||||||
bindgetphonenumber="bindGetPhoneNumber"
|
open-type="{{ confirmButtonOpenType }}"
|
||||||
binderror="bindError"
|
bind:click="onConfirm"
|
||||||
bindopensetting="bindOpenSetting"
|
binderror="bindError"
|
||||||
>
|
bindcontact="bindContact"
|
||||||
{{ confirmButtonText }}
|
bindopensetting="bindOpenSetting"
|
||||||
</van-button>
|
bindgetuserinfo="bindGetUserInfo"
|
||||||
</view>
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
|
>
|
||||||
|
{{ confirmButtonText }}
|
||||||
|
</van-button>
|
||||||
</view>
|
</view>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
export const button = Behavior({
|
export const button = Behavior({
|
||||||
properties: {
|
properties: {
|
||||||
id: String,
|
id: String,
|
||||||
|
sessionFrom: String,
|
||||||
appParameter: String,
|
appParameter: String,
|
||||||
sendMessageTitle: String,
|
|
||||||
sendMessagePath: String,
|
|
||||||
sendMessageImg: String,
|
sendMessageImg: String,
|
||||||
|
sendMessagePath: String,
|
||||||
showMessageCard: String,
|
showMessageCard: String,
|
||||||
|
sendMessageTitle: String,
|
||||||
hoverStopPropagation: Boolean,
|
hoverStopPropagation: Boolean,
|
||||||
hoverStartTime: {
|
hoverStartTime: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -19,9 +20,5 @@ export const button = Behavior({
|
|||||||
type: String,
|
type: String,
|
||||||
value: 'en'
|
value: 'en'
|
||||||
},
|
},
|
||||||
sessionFrom: {
|
|
||||||
type: String,
|
|
||||||
value: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user