|
@@ -27,7 +27,8 @@ export default defineComponent({
|
|
|
swiperIndex: 0,
|
|
|
image: null as any,
|
|
|
codeUrl: '',
|
|
|
- shareLoading: false
|
|
|
+ shareLoading: false,
|
|
|
+ saveLoading: false
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
@@ -46,6 +47,11 @@ export default defineComponent({
|
|
|
},
|
|
|
methods: {
|
|
|
async onSaveImg() {
|
|
|
+ // 判断是否在保存中...
|
|
|
+ if (this.saveLoading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.saveLoading = true
|
|
|
const container: any = document.getElementById(
|
|
|
`share-preview-container${this.swiperIndex}`
|
|
|
)
|
|
@@ -57,6 +63,9 @@ export default defineComponent({
|
|
|
.then(async canvas => {
|
|
|
const url = canvas.toDataURL('image/png')
|
|
|
this.image = url
|
|
|
+ setTimeout(() => {
|
|
|
+ this.saveLoading = false
|
|
|
+ }, 100)
|
|
|
Toast.loading({
|
|
|
message: '图片生成中...',
|
|
|
forbidClick: true
|
|
@@ -198,7 +207,14 @@ export default defineComponent({
|
|
|
</div>
|
|
|
|
|
|
<div class={['btnGroup', styles.shareGroupBtn]}>
|
|
|
- <Button type="primary" plain round onClick={this.onSaveImg}>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ round
|
|
|
+ loading={this.saveLoading}
|
|
|
+ loadingText="保存中"
|
|
|
+ onClick={this.onSaveImg}
|
|
|
+ >
|
|
|
保存图片
|
|
|
</Button>
|
|
|
<Button
|