App.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <script>
  2. export default {
  3. globalData: {
  4. // 默认赛事LOGO
  5. defaultMatchLogo: "https://oss-mbh5.colormaprun.com/static/logo/default.png",
  6. // 默认赛事BANNER
  7. defaultMatchBanner: "https://oss-mbh5.colormaprun.com/static/banner/banner1.png"
  8. },
  9. onLaunch: function() {
  10. // console.log('App Launch')
  11. const style = document.documentElement.style;
  12. // 通过JS设置CSS变量值
  13. const defaultMatchLogoUrl = `url("${this.globalData.defaultMatchLogo}")`;
  14. style.setProperty('--default-matchLogo-url', defaultMatchLogoUrl);
  15. const defaultMatchBannerUrl = `url("${this.globalData.defaultMatchBanner}")`;
  16. style.setProperty('--default-matchBanner-url', defaultMatchBannerUrl);
  17. // 通过JS获取CSS变量值
  18. // console.log("--default-matchLogo-url:", style.getPropertyValue('--default-matchLogo-url'));
  19. // console.log("--default-matchBanner-url:", style.getPropertyValue('--default-matchBanner-url'));
  20. },
  21. onShow: function() {
  22. // console.log('App Show')
  23. // this.$audio.play();
  24. },
  25. onHide: function() {
  26. // console.log('App Hide')
  27. // this.$audio.pause();
  28. },
  29. methods: {}
  30. }
  31. </script>
  32. <style>
  33. /*每个页面公共css */
  34. @import "global.css";
  35. </style>