首页 > 其他分享 >前端Vue自定义微信支付弹框dialog alert popup

前端Vue自定义微信支付弹框dialog alert popup

时间:2023-06-28 10:00:25浏览次数:59  
标签:function Vue false 自定义 default 微信 支付 payVisible

前端Vue自定义微信支付弹框dialog alert popup, 下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13245

效果图如下:

实现代码如下:

cc-payDialog

使用方法


<!--:money:支付金额  show:是否显示 @cancel:取消  @success:确认支付 -->

<cc-payDialog :money="money" :show="payVisible" @cancel="cancelPayHandle" @success="successPayHandle"></cc-payDialog>

HTML代码实现部分


<template>

<view class="content">

<button style="margin-top: 29px;" @click="goPayClick">微信支付</button>

<!--:money:支付金额  show:是否显示 @cancel:取消  @success:确认支付 -->

<cc-payDialog :money="money" :show="payVisible" @cancel="cancelPayHandle"

@success="successPayHandle"></cc-payDialog>

</view>

</template>

<script>

export default {

components: {

},

data() {

return {

payVisible: false,

money: '88',

};

},

onLoad: function(e) {

},

methods: {

goPayClick() {

this.payVisible = true;

},

successPayHandle: function() {

this.payVisible = true;

},

cancelPayHandle: function() {

this.payVisible = false;

},

}

};

</script>

<style lang="scss" scoped>

.content {

display: flex;

flex-direction: column;

}

</style>

组件实现代码


<template>

<view :class="'pop-up ' + (show ? 'show' : 'hide')">

<view @tap="close" class="pop-up-mask ptp_exposure" data-ptpid="1fkl-vm1a-vieo-9fh2" v-if="show"></view>

<view :class="'pop-box ' + (isPartDetails ? 'pb' : '')">

<view class="pop-box-title">现金支付</view>

<view @tap="close" class="iconfont iconclose pop-box-close ptp_exposure" data-ptpid="fk13-fu28-zfo1-82hf">

</view>

<view class="pop-box-select">

<view>微信</view>

<view class="iconfont iconradio_selected pop-box-icon"></view>

</view>

<view class="pop-box-tips">

<text>需支付:</text>

<text class="pop-box-tips-red">{{ money }}元</text>

</view>

<view class="pop-box-agreement">

<image @tap="selectHandle" class="pop-box-agreement-icon"

src="https://qiniu-image.qtshe.com/20210617_selectActive.png" v-if="select"></image>

<image @tap="selectHandle" class="pop-box-agreement-icon"

src="https://qiniu-image.qtshe.com/20210617_select.png" v-else></image>

<view>本人确认</view>

<view @tap="jumpToAgreement" class="pop-box-agreement-text" data-ptpid="ufn1-vm1a-vo2m-vu2b">《支付相关协议》

</view>

</view>

<view @tap="payHandle" class="pop-box-button ptp_exposure" data-ptpid="du1g-f8h1-ch1n-vhm1">确认支付</view>

</view>

</view>

</template>

<script>

export default {

data() {

return {

select: true

};

},

props: {

show: {

type: Boolean,

default: false

},

money: {

type: [String, Number],

default: 0.01

},

isPartDetails: {

type: Boolean,

default: false

}

},

methods: {

close: function() {

this.$emit("cancel")

},

payHandle: function() {

this.$emit("success")

},

jumpToAgreement: function() {

},

selectHandle: function() {

this.select = !this.select;

}

}

};

</script>

<style lang="scss">

@import './index.scss';

</style>

标签:function,Vue,false,自定义,default,微信,支付,payVisible
From: https://www.cnblogs.com/ccVue/p/17510594.html

相关文章

  • vue自动将px转换成rem
    1.首先下载lib-flexiblenpminstalllib-flexible--save2.在main.js中引用 lib-flexibleimport'lib-flexible/flexible'3.安装px2rem-loader(将px转换成rem)npminstallpx2rem-loader4.配置px2rem(在build/utils.js中配置px2rem)我这边是根据iphone6的设计图尺寸......
  • vue组件-使用Vue.component全局注册组件
    通过components注册的时私有子组件例如:在组件A的components节点下,注册了组件F。则组件F只能用在组件A中;不能被用在组件C中。注册全局组件在vue项目的main.js入口文件中,通过Vue.component()方法,可以注册全局组件。importVuefrom'vue'importAppfrom'./App.vue'//导......
  • vue-组件-使用组件的三个步骤
    组件之间的父子关系使用组件的三个步骤......
  • SpringBoot自定义starter
    1、先来一个简单的案例非常简单的工程结构controllerpackagecom.ly.demo.controller;importcom.ly.demo.service.MyStarterService;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.web.bind.annotation.GetMapping;import......
  • vue组件-启用less语法以及唯一根节点
    <template><div><divclass="test-box"><h3>这是用户自定义的Test.vue---{{username}}</h3><button@click="changeName">修改用户名</button></div>&l......
  • vue透传 Attributes
    Attributes继承​在此之前,先来弥补一个小知识点,vue3支持多个根节点,vue2不支持,<!--vue2:错误的写法--><template><div></div><div></div></template><!--vue3:正确--><template><div></div><div></......
  • 自定义代码片段
    前言使用自定义代码片段可以快速生成代码片段,提升开发效率。使用在vscode中ctrl+shift+p,新建全局代码片段。写好模板,复制进这个网站https://snippet-generator.app/将生成的模板复制进文件中......
  • vue模板大小写区分
    HTML标签和属性名称是不分大小写的,所以浏览器会把任何大写的字符解释为小写。这意味着当你使用DOM内的模板时,无论是PascalCase形式的组件名称、camelCase形式的prop名称还是v-on的事件名称,都需要转换为相应等价的kebab-case(短横线连字符)形式://JavaScript中的ca......
  • vue3 defineExpose()
    使用scriptsetup的组件是默认关闭的——即通过模板引用或者$parent链获取到的组件的公开实例,不会暴露任何在scriptsetup中声明的绑定。可以通过defineExpose编译器宏来显式指定在scriptsetup组件中要暴露出去的属性:<scriptsetup>import{ref}from'vue'const......
  • vue3自定义hook
    什么是hookshook是钩子的意思,看到“钩子”是不是就想到了钩子函数?事实上,hooks还真是函数的一种写法。vue3借鉴reacthooks开发出了CompositionAPI,所以也就意味着CompositionAPI也能进行自定义封装hooks。vue3中的hooks就是函数的一种写法,就是将文件的一些单独功......