vue 组建交互

home.vue

<alert-Plane @colseplan="colseplan" @confirm='receivepet' v-show='this.getpeterror' :btnType='1' :titlename='"提示"' :OneBtnTxt='"重新领取"'>

            <div slot="content" class="alertcontent">
               {{message}}
            </div>

 </alert-Plane>

<script>

import alertPlane from '../../components/alertplane';

export default {

    components:{
        alertPlane
    },

}

</script>

组件

alertplane.vue 

<template>

    <div class="alert" >
        <div class="control borderradius">
            <div class="title">
                {{titlename}}<span class="close" @click="closeAlert()"></span>
            </div>
            <slot name="content" class="content"/>
            <div class="btns">
                <div v-show="btnType=='1'" class="type1">
                    <a class="yellow_btn_white" @click='btnClick("yes")'>{{OneBtnTxt}}</a>
                </div>
                <div v-show="btnType=='2'" class="type2">
                    <a class="bt1" @click='btnClick("no")'>{{twobtntitle[0].title}}</a>
                    <a class="bt2" @click='btnClick("yes")'>{{twobtntitle[1].title}}</a>
                </div>
            </div>
        </div>
        <div id='mask' @click="closeAlert()"></div>
    </div>
</template>
<script>
    export default {
        data(){
            return{
              
            }
        },
        mounted(){
          
        },
        props:{  
            content:{
              type: String,
              default:""
            },
            btnType:{
              type:Number,
              default:1
            },
            OneBtnTxt:{
                type:String,
                default:""
            },
            titlename:{
                type:String,
                default:""
            },
            twobtntitle:{
              type:Array,
              default:function(){
                return ["取消","确定"]
              }
            }
        },
        computed: {
        },
        methods: {
          gotoAddress(path){
              this.$router.push(path)
          },
          closeAlert:function(){
            this.$emit('colseplan','true');
          },
          btnClick:function(str){
            if(str=='yes'){
              this.$emit('confirm','true');
            }else if(str=='no'){
              this.$emit('confirm','false');
            }
            
          },
          twobtn:function(){
            var arr = ["取消","确定"];
            return arr
          }
        },
    }
</script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值