1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  | <template> 
 |    <div class="import-button"> 
 |      <el-button type="primary" @click="$refs.importWindow.open(text)">{{text}}</el-button> 
 |      <ImportWindow :action="action" :template-path="templatePath" :template-name="templateName" ref="importWindow" :type="type" @success="handleSuccess"/> 
 |    </div> 
 |  </template> 
 |    
 |  <script> 
 |  import ImportWindow from './ImportWindow' 
 |  export default { 
 |    name: 'ImportButton', 
 |    components: { ImportWindow }, 
 |    props: { 
 |      // 按钮文案 
 |      text: { 
 |        default: '导入' 
 |      }, 
 |      // 模版地址 
 |      templatePath: { 
 |        required: true 
 |      }, 
 |       // 选择type 
 |      type: { 
 |        type: Array, 
 |        default: () => [] 
 |      }, 
 |      // 下载后的模版文件名称 
 |      templateName: { 
 |        required: true 
 |      }, 
 |      // 导入接口地址 
 |      action: { 
 |        required: true 
 |      } 
 |    }, 
 |    methods: { 
 |      handleSuccess () { 
 |        this.$emit('success') 
 |      } 
 |    } 
 |  } 
 |  </script> 
 |  
  |