美文网首页
二选一 选择支付方式 vue实现

二选一 选择支付方式 vue实现

作者: daoqing99 | 来源:发表于2017-03-08 15:31 被阅读0次
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style type="text/css">
        .paymentweixin {
            width: 100%;
            height: 72px;
            border-bottom: 1px solid #f0f0f0;
            position: relative;
        }
        
        .paymentweixinimg {
            width: 45px;
            margin-top: 15px;
            margin-left: 10px;
        }
        
        .queren {
            width: 25px;
            position: absolute;
            top: 25px;
            right: 15px;
        }
        </style>
    </head>
    
    <body>
        <div id='payMethod'>
            <div class="paymentweixin" @click="weixin">
                <img Arc="weixin.png" class="paymentweixinimg" />
                <img Arc="quren.png" v-show="isShowA" class="queren" />
                <img Arc="cancel.png" v-show="isShowB" class="queren" />
            </div>
            <div class="paymentweixin" @click="zhifubao">
                <img Arc="zhifubao.png" class="paymentweixinimg" />
                <img Arc="cancel.png" v-show="isShowA" class="queren" />
                <img Arc="quren.png" v-show="isShowB" class="queren" />
            </div>
        </div>
        <script src="http://cdn.bootcss.com/vue/1.0.28/vue.js"></script>
        <script type="text/javascript">
        //http://om1gg1n7c.bkt.clouddn.com/quren.png
        //http://om1gg1n7c.bkt.clouddn.com/cancel.png
        //http://om1gg1n7c.bkt.clouddn.com/zhifubao.png
        //http://om1gg1n7c.bkt.clouddn.com/weixin.png
        //          选择支付方式
        var vm = new Vue({
            el: "#payMethod",
            data: {
                isShowA: true,
                isShowB: false
            },
            methods: {
                weixin: function() {
                    if (this.isShowA) {
                        this.isShowA = true;
                        this.isShowB = false;
                    } else {
                        this.isShowA = true;
                        this.isShowB = false;
                    }
                },
                zhifubao: function() {
                    if (this.isShowA) {
                        this.isShowA = false;
                        this.isShowB = true;
                    }
                }
            }
        })
        </script>
    </body>
    
    </html>
    
    

    相关文章

      网友评论

          本文标题:二选一 选择支付方式 vue实现

          本文链接:https://www.haomeiwen.com/subject/pdbbgttx.html