VciD3.vue 949 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div class="VciD3">
  3. <div
  4. ref="vd"
  5. class="vd-view"
  6. ></div>
  7. <slot></slot>
  8. </div>
  9. </template>
  10. <script>
  11. // power by visual-ceiling, at 2023/7/26 15:17
  12. import QuickThree from "../src/index";
  13. import { QtEvents } from "../src/events/QtEvents";
  14. export default {
  15. name: "VciD3",
  16. props: {
  17. beforeInitQt: {
  18. type: Function,
  19. default: null
  20. }
  21. },
  22. data() {
  23. return {};
  24. },
  25. mounted() {
  26. const optionQt = { el: this.$refs.vd };
  27. this.beforeInitQt && this.beforeInitQt(optionQt);
  28. this.vd = new QuickThree(optionQt);
  29. this.vd.addEventListener(QtEvents.AfterMount, e => this.$emit("ready", e.target));
  30. },
  31. beforeDestroy() {
  32. this.vd && this.vd.destroy();
  33. }
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. .VciD3 {
  38. position: relative;
  39. width: 100%;
  40. height: 100%;
  41. z-index: 1;
  42. .vd-view {
  43. position: relative;
  44. z-index: 6;
  45. width: 100%;
  46. height: 100%;
  47. }
  48. }
  49. </style>