Преглед на файлове

文件下载后,更改名称后,打开文件,增加顺时方式,防止名称未更改就去打开文件,导致打不开文件

sucheng преди 1 година
родител
ревизия
ff7e263de4
променени са 1 файла, в които са добавени 15 реда и са изтрити 10 реда
  1. 15 10
      pages/index/index.vue

+ 15 - 10
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<web-view src="http://192.168.0.117:3200" @message="handleMessage"></web-view>
+		<web-view src="http://192.168.0.205:8000" @message="handleMessage"></web-view>
 		<!-- <button @click="downloadFile">点击下载文件</button> -->
 	</view>
 </template>
@@ -23,7 +23,7 @@
 
 
 		onLoad: function() {
-			this.handleMessage();
+			// this.handleMessage();
 			// this.downloadFile();
 		},
 		methods: {
@@ -102,16 +102,21 @@
 										entry.getParent(_oldFile => {
 											entry.moveTo(_oldFile, '/' + _name,
 												newFilePath => {
-													console.log('newFilePath',
-														newFilePath
-														.fullPath)
+													console.log('文件名称替换完成');
 												})
 										})
 									})
-
-									uni.openDocument({
-										filePath: newFilePath
-									});
+									setTimeout(()=>{
+										uni.openDocument({
+											filePath: newFilePath,
+											success() {
+												console.log('打开成功');
+											},
+											fail() {
+												console.log('打开失败');
+											}
+										});
+									},1000)
 								}
 							});
 						}
@@ -124,7 +129,7 @@
 						});
 					},
 				})
-			}
+			},
 
 		}
 	}