tyler 2 лет назад
Родитель
Сommit
b6157f611a
1 измененных файлов с 20 добавлено и 0 удалено
  1. 20 0
      src/App.vue

+ 20 - 0
src/App.vue

@@ -13,7 +13,27 @@ export default {
     document.body.addEventListener('plugin_web_update_notice', (e) => {
       const { version, options } = e.detail
       // write some code, show your custom notification and etc.
+      console.log(version, options)
       alert('System update!')
+      this.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {
+        distinguishCancelAndClose: true,
+        confirmButtonText: '保存',
+        cancelButtonText: '放弃修改'
+      })
+        .then(() => {
+          this.$message({
+            type: 'info',
+            message: '保存修改'
+          })
+        })
+        .catch(action => {
+          this.$message({
+            type: 'info',
+            message: action === 'cancel'
+              ? '放弃保存并离开页面'
+              : '停留在当前页面'
+          })
+        })
     })
   }
 }