Procházet zdrojové kódy

部署后提示用户更新32

tyler před 2 roky
rodič
revize
00c035a9eb
1 změnil soubory, kde provedl 51 přidání a 48 odebrání
  1. 51 48
      src/App.vue

+ 51 - 48
src/App.vue

@@ -4,7 +4,7 @@
     <el-dialog
       :title="$t('notificationProps.title')"
       :visible.sync="dialogVisible"
-      width="30%"
+      width="320px"
     >
       <span>{{ $t('notificationProps.description') }}</span>
       <span slot="footer" class="dialog-footer">
@@ -25,55 +25,58 @@ export default {
       dialogVisible: false
     }
   },
-  created() {
-    const self = this
-    const language = store.state.app.language
-    document.body.addEventListener('plugin_web_update_notice', (e) => {
-      const { version, options } = e.detail
-      console.log(version, options)
-      self.dialogVisible = true
-      // if (language === 'en') {
-      //   self.$confirm('System update detected, please refresh the page?', '📢 System update', {
-      //     distinguishCancelAndClose: true,
-      //     closeOnClickModal: false,
-      //     customClass: 'message_refresh',
-      //     confirmButtonText: 'refresh',
-      //     cancelButtonText: 'dismiss'
-      //   })
-      //     .then(() => {
-      //       location.reload()
-      //     })
-      //     .catch(action => {
-      //       self.$message({
-      //         type: 'info',
-      //         message: action === 'cancel'
-      //           ? 'Abandon'
-      //           : 'Stay on the current page'
-      //       })
-      //     })
-      // } else {
-      //   self.$confirm('检测到系统更新,请刷新页面?', '📢 系统更新', {
-      //     distinguishCancelAndClose: true,
-      //     closeOnClickModal: false,
-      //     customClass: 'message_refresh',
-      //     confirmButtonText: '刷新',
-      //     cancelButtonText: '放弃'
-      //   })
-      //     .then(() => {
-      //       location.reload()
-      //     })
-      //     .catch(action => {
-      //       self.$message({
-      //         type: 'info',
-      //         message: action === 'cancel'
-      //           ? '放弃'
-      //           : '停留在当前页面'
-      //       })
-      //     })
-      // }
-    })
+  mounted() {
+    this.init()
   },
   methods: {
+    init(){
+      const self = this
+      const language = store.state.app.language
+      document.body.addEventListener('plugin_web_update_notice', (e) => {
+        const { version, options } = e.detail
+        console.log(version, options)
+        self.dialogVisible = true
+        // if (language === 'en') {
+        //   self.$confirm('System update detected, please refresh the page?', '📢 System update', {
+        //     distinguishCancelAndClose: true,
+        //     closeOnClickModal: false,
+        //     customClass: 'message_refresh',
+        //     confirmButtonText: 'refresh',
+        //     cancelButtonText: 'dismiss'
+        //   })
+        //     .then(() => {
+        //       location.reload()
+        //     })
+        //     .catch(action => {
+        //       self.$message({
+        //         type: 'info',
+        //         message: action === 'cancel'
+        //           ? 'Abandon'
+        //           : 'Stay on the current page'
+        //       })
+        //     })
+        // } else {
+        //   self.$confirm('检测到系统更新,请刷新页面?', '📢 系统更新', {
+        //     distinguishCancelAndClose: true,
+        //     closeOnClickModal: false,
+        //     customClass: 'message_refresh',
+        //     confirmButtonText: '刷新',
+        //     cancelButtonText: '放弃'
+        //   })
+        //     .then(() => {
+        //       location.reload()
+        //     })
+        //     .catch(action => {
+        //       self.$message({
+        //         type: 'info',
+        //         message: action === 'cancel'
+        //           ? '放弃'
+        //           : '停留在当前页面'
+        //       })
+        //     })
+        // }
+      })
+    },
     notificationRefresh() {
       // setTimeout()
       location.reload()