将弹窗组件定义出来
先定义一个单独组件modal.vue,$emit子传父,props:父传子
<template>
<transition name="slide">
<div class="modal" v-show="showModal">
<div class="mask"></div>
<div class="modal-dialog">
<div class="modal-header">
<span>{
{
title}}</span>
<a href="javascript:;" class="icon-close" @click="$emit('cancel')"></a>
</div>
<div class="modal-body">
<slot name="body"></slot>
</div>
<div class="modal-footer">
<a href="javascript:;" class="btn" v-if="btnType==1" @click="$emit('submit')">{
{
sureText}}</a>
<a href="javascript:;" class="btn" v-if="btnType==2" @click=