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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
<div>
<div v-if="!isdoc" style="height:600px;overflow:auto;">
<pre>{{srcmsg}}</pre>
</div>
<div v-if="isdoc">
<embed :src="realdocpath" style="width:100%;height:600px;"/>
</div>
</div>
</template>
<script>
import Api from "~/service/Api"
export default {
props:['path'],
data(){
return {
srcmsg:""
}
},
methods:{
async showDocOrMsg(){
this.dialogOpen = true
console.log(this.realdocpath)
if(!this.isdoc)
{
//发出异步请求
let msg = await Api.pget(this.realdocpath)
this.srcmsg = msg
}
}
},
computed:{
isdoc(){
if(this.path.endsWith(".pdf"))
return true
else
return false
},
realdocpath(){
return '/gjjs/files'+this.path
},
title(){
if(this.isdoc)
return "面函展示"
else
return "报文展示"
}
},
mounted(){
this.showDocOrMsg()
},
watch:{
path(newValue,oldValue){
if(newValue!=oldValue)
this.showDocOrMsg()
}
},
updated(){
}
}
</script>