App.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. import store from './store'
  8. export default {
  9. name: 'App',
  10. created() {
  11. const self = this
  12. console.log(store.state.app.language)
  13. document.body.addEventListener('plugin_web_update_notice', (e) => {
  14. const { version, options } = e.detail
  15. // write some code, show your custom notification and etc.
  16. console.log(version, options)
  17. // alert('System update!')
  18. self.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {
  19. distinguishCancelAndClose: true,
  20. confirmButtonText: '保存',
  21. cancelButtonText: '放弃修改'
  22. })
  23. .then(() => {
  24. self.$message({
  25. type: 'info',
  26. message: '保存修改'
  27. })
  28. })
  29. .catch(action => {
  30. self.$message({
  31. type: 'info',
  32. message: action === 'cancel'
  33. ? '放弃保存并离开页面'
  34. : '停留在当前页面'
  35. })
  36. })
  37. })
  38. }
  39. }
  40. </script>