优化代码

This commit is contained in:
wangsongsole 2022-09-23 12:10:46 +08:00
parent 67e35ce1b2
commit 34654e7afd
3 changed files with 10 additions and 10 deletions

View File

@ -413,11 +413,11 @@
this.reAccount = ""; this.reAccount = "";
}, },
/* 确认付款 */ /* 去支付 */
payFunction (va) { payFunction ({ type, isSupport }) {
this.active = va this.active = type
this.show = false this.show = false
alert(`确认付款 选择的是${va === 1 ? '微信' : '支付宝'}`) alert(isSupport ? '不持支' : '支持')
}, },
/* 监听账号 */ /* 监听账号 */

View File

@ -46,7 +46,7 @@
<tab-component :current="2"></tab-component> <tab-component :current="2"></tab-component>
<!-- 支付弹窗 --> <!-- 支付弹窗 -->
<pay-pop :show="show" :active="active" @setShow="show = false" @payFunction="payFunction" /> <pay-pop :show.sync="show" :active="active" @payFunction="payFunction" />
</div> </div>
<script> <script>
new Vue({ new Vue({
@ -132,7 +132,7 @@
}, },
/* 去支付 */ /* 去支付 */
payFunction (type, isSupport) { payFunction ({ type, isSupport }) {
this.active = type this.active = type
this.show = false this.show = false
alert(isSupport ? '不持支' : '支持') alert(isSupport ? '不持支' : '支持')

View File

@ -23,7 +23,7 @@ const payPop = {
<img class="icon-select" v-else src="./img/no-active.png" alt=""> <img class="icon-select" v-else src="./img/no-active.png" alt="">
</div> </div>
</div> </div>
<button @click='payFunction' class="pay">确认付款</button> <button @click='payFunctions' class="pay">确认付款</button>
</div> </div>
</div> </div>
`, `,
@ -43,17 +43,17 @@ const payPop = {
methods: { methods: {
/* 支付 */ /* 支付 */
payFunction() { payFunctions() {
const us = navigator.userAgent const us = navigator.userAgent
let isSupport = false /* false:支持当前环境 true:不支持当前环境 */ let isSupport = false /* false:支持当前环境 true:不支持当前环境 */
if (!!us.match(/DingTalk/gi) && this.active !== 2) isSupport = true if (!!us.match(/DingTalk/gi) && this.active !== 2) isSupport = true
if (!!us.match(/weiXin/gi) && this.active !== 1) isSupport = true if (!!us.match(/weiXin/gi) && this.active !== 1) isSupport = true
this._events.payfunction[0](this.active, isSupport) this.$emit("payfunction", { active: this.active, isSupport })
}, },
/* 关闭 */ /* 关闭 */
colesFunction() { colesFunction() {
this._events.setshow[0]() this.$emit("update:show", false)
} }
} }
} }