game.vue 701 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <view class="content">
  4. </view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. bUnload: false
  12. }
  13. },
  14. onLoad(op) {
  15. /**
  16. * $on 之后要调用 $off,不然会重复绑定
  17. */
  18. uni.$on("game-load", () => {
  19. uni.$emit("setOnceGameOption", {});
  20. });
  21. uni.$on("game-unload", (data) => {
  22. if (!this.bUnload) {
  23. this.bUnload = true;
  24. uni.navigateBack({
  25. delta: 1
  26. })
  27. }
  28. });
  29. },
  30. onUnload() {
  31. //subview
  32. uni.$off("game-load");
  33. uni.$off("game-unload");
  34. },
  35. methods: {
  36. }
  37. }
  38. </script>
  39. <style>
  40. .content {
  41. align-content: center;
  42. height: 750rpx;
  43. background-color: #F4F5F6;
  44. }
  45. </style>