refactor: replace uni.showToast calls with shared toast
consolidates repeated toast display logic into a centralized utility, reducing code duplication and standardizing toast behavior across the codebase
This commit is contained in:
@@ -1,25 +1,12 @@
|
||||
<template xlang="wxml" minapp="mpvue">
|
||||
<div class="tki-qrcode">
|
||||
<!-- #ifndef MP-ALIPAY -->
|
||||
<canvas
|
||||
class="tki-qrcode-canvas"
|
||||
:canvas-id="cid"
|
||||
:style="{ width: cpSize + 'px', height: cpSize + 'px' }"
|
||||
/>
|
||||
<canvas class="tki-qrcode-canvas" :canvas-id="cid" :style="{ width: cpSize + 'px', height: cpSize + 'px' }" />
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<canvas
|
||||
:id="cid"
|
||||
:width="cpSize"
|
||||
:height="cpSize"
|
||||
class="tki-qrcode-canvas"
|
||||
/>
|
||||
<canvas :id="cid" :width="cpSize" :height="cpSize" class="tki-qrcode-canvas" />
|
||||
<!-- #endif -->
|
||||
<img
|
||||
v-show="show"
|
||||
:src="result"
|
||||
:style="{ width: cpSize + 'px', height: cpSize + 'px' }"
|
||||
/>
|
||||
<img v-show="show" :src="result" :style="{ width: cpSize + 'px', height: cpSize + 'px' }" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -176,11 +163,7 @@ const _makeCode = () => {
|
||||
}
|
||||
} else {
|
||||
console.log("二维码内容为空");
|
||||
uni.showToast({
|
||||
title: "二维码内容不能为空",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
showToast("二维码内容不能为空");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -196,11 +179,7 @@ const _saveCode = () => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: result.value,
|
||||
success: function () {
|
||||
uni.showToast({
|
||||
title: "二维码保存成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
showToast("二维码保存成功");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user