index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Component({
  2. behaviors: [require('../common/share-behavior').default],
  3. properties: {
  4. markerImg: {
  5. type: String
  6. },
  7. },
  8. data: {
  9. loaded: false,
  10. arReady: false,
  11. toyReady: false,
  12. gzDayReady: false,
  13. gzNightReady: false,
  14. },
  15. lifetimes: {
  16. async attached() {
  17. console.log('data', this.data);
  18. }
  19. },
  20. methods: {
  21. handleReady({
  22. detail
  23. }) {
  24. const xrScene = this.scene = detail.value;
  25. console.log('xr-scene', xrScene);
  26. },
  27. handleAssetsProgress: function ({
  28. detail
  29. }) {
  30. console.log('assets progress', detail.value);
  31. },
  32. handleAssetsLoaded: function ({
  33. detail
  34. }) {
  35. console.log('assets loaded', detail.value);
  36. this.setData({
  37. loaded: true
  38. });
  39. },
  40. handleToySwitch: function ({detail}) {
  41. const active = detail.value;
  42. if (active) {
  43. this.setData({toyReady: true});
  44. } else {
  45. this.setData({toyReady: false});
  46. }
  47. },
  48. handleDaySwitch: function ({detail}) {
  49. const active = detail.value;
  50. if (active) {
  51. this.setData({gzDayReady: true});
  52. } else {
  53. this.setData({gzDayReady: false});
  54. }
  55. },
  56. handleNightSwitch: function ({detail}) {
  57. const active = detail.value;
  58. if (active) {
  59. this.setData({gzNightReady: true});
  60. } else {
  61. this.setData({gzNightReady: false});
  62. }
  63. }
  64. }
  65. })