feat: Button 支持微信小程序chooseavatar和agreeprivacyauthorization事件

This commit is contained in:
xuqingkai 2024-02-27 13:11:20 +08:00
parent e8b5c1af51
commit 177c726e0d

View File

@ -33,6 +33,8 @@
@error="handleError" @error="handleError"
@launchapp="handleLaunchapp" @launchapp="handleLaunchapp"
@opensetting="handleOpensetting" @opensetting="handleOpensetting"
@chooseavatar="handleChooseavatar"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization"
> >
<view v-if="loading" class="wd-button__loading"> <view v-if="loading" class="wd-button__loading">
<view class="wd-button__loading-svg" :style="loadingStyle"></view> <view class="wd-button__loading-svg" :style="loadingStyle"></view>
@ -123,7 +125,17 @@ const loadingStyle = computed(() => {
return `background-image: url(${loadingIconSvg.value});` return `background-image: url(${loadingIconSvg.value});`
}) })
const emit = defineEmits(['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'launchapp', 'opensetting']) const emit = defineEmits([
'click',
'getuserinfo',
'contact',
'getphonenumber',
'error',
'launchapp',
'opensetting',
'chooseavatar',
'agreeprivacyauthorization'
])
function handleClick(event) { function handleClick(event) {
if (!props.disabled && !props.loading) { if (!props.disabled && !props.loading) {
@ -154,6 +166,14 @@ function handleLaunchapp(event) {
function handleOpensetting(event) { function handleOpensetting(event) {
emit('opensetting', event.detail) emit('opensetting', event.detail)
} }
function handleChooseavatar(event) {
emit('chooseavatar', event.detail)
}
function handleAgreePrivacyAuthorization(event) {
emit('agreeprivacyauthorization', event.detail)
}
function buildLoadingSvg() { function buildLoadingSvg() {
const { loadingColor, type, plain } = props const { loadingColor, type, plain } = props
let color = loadingColor let color = loadingColor