App.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <script>
  2. import checkVersion from '@/pages/lq-upgrade/checkVersion.js'
  3. export default {
  4. onLaunch: function() {
  5. console.log('App Launch')
  6. this.upgrade()
  7. },
  8. onShow: function() {
  9. console.log('App Show')
  10. },
  11. onHide: function() {
  12. console.log('App Hide')
  13. },
  14. methods: {
  15. upgrade(){
  16. let res=uni.$u.http.post('admin/api.login/appupdata').then(res => {
  17. //模拟接口请求
  18. // console.log(res)
  19. setTimeout(()=>{
  20. let name=res.version
  21. let code=res.code
  22. let content=res.content
  23. let url=res.url
  24. let forceUpdate=false;//是否强制更新
  25. checkVersion({
  26. name,//最新版本名称
  27. code,//最新版本号
  28. content,//更新内容
  29. url,//下载链接
  30. forceUpdate//是否强制升级
  31. })
  32. },1000)
  33. })
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. @import "uni_modules/uview-ui/index.scss";
  40. /*每个页面公共css */
  41. // @import "./static/css/iconfont.css";
  42. </style>