|
@@ -4,11 +4,13 @@
|
4
|
4
|
class="upload-demo"
|
5
|
5
|
drag
|
6
|
6
|
action="/upload"
|
7
|
|
- :on-success="uploadSuccess"
|
|
7
|
+ :on-progress="handleUploadProgress"
|
|
8
|
+ :on-success="handleUploadSuccess"
|
|
9
|
+ :on-error="handleUploadError"
|
8
|
10
|
>
|
9
|
11
|
<i class="el-icon-upload"></i>
|
10
|
12
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
11
|
|
- <div class="el-upload__tip" slot="tip">上传文件不超过500kb</div>
|
|
13
|
+ <div class="el-upload__tip" slot="tip">拖动文件至此即可生成火焰图</div>
|
12
|
14
|
</el-upload>
|
13
|
15
|
</div>
|
14
|
16
|
</template>
|
|
@@ -16,10 +18,28 @@
|
16
|
18
|
<script>
|
17
|
19
|
export default {
|
18
|
20
|
name: "Upload",
|
19
|
|
- methods:{
|
20
|
|
- uploadSuccess(response,file,fileList){
|
21
|
|
- console.log(response,file,fileList)
|
22
|
|
- window.location.href="http://localhost:8090/pprof/"+response.data+"/dot"
|
|
21
|
+ data() {
|
|
22
|
+ return {
|
|
23
|
+ src: 'http://localhost:8090/pprof/bd5001ffcea7949ff66b7368b1912aa7/dot',
|
|
24
|
+ loading: null
|
|
25
|
+ }
|
|
26
|
+ },
|
|
27
|
+ methods: {
|
|
28
|
+ handleUploadSuccess(response) {
|
|
29
|
+ this.loading.close()
|
|
30
|
+ window.location.href = "http://localhost:8090/pprof/" + response.data + "/dot"
|
|
31
|
+ },
|
|
32
|
+ handleUploadError() {
|
|
33
|
+ this.loading.close()
|
|
34
|
+ this.$message.error("文件上传失败或文件格式错误")
|
|
35
|
+ },
|
|
36
|
+ handleUploadProgress() {
|
|
37
|
+ this.loading = this.$loading({
|
|
38
|
+ lock: true,
|
|
39
|
+ text: 'Loading',
|
|
40
|
+ spinner: 'el-icon-loading',
|
|
41
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
42
|
+ });
|
23
|
43
|
}
|
24
|
44
|
}
|
25
|
45
|
}
|