index.tsx 1007 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineComponent, ref } from 'vue';
  2. import styles from './index.module.less';
  3. import { useUserStore } from '/src/store/modules/users';
  4. export default defineComponent({
  5. name: 'song-modal',
  6. props: {
  7. item: {
  8. type: Object,
  9. default: () => ({})
  10. }
  11. },
  12. setup(props) {
  13. const userStore = useUserStore();
  14. const iframeRef = ref();
  15. const isLoaded = ref(false);
  16. const origin = /(localhost|192)/.test(location.host)
  17. ? 'https://dev.kt.colexiu.com'
  18. : location.origin;
  19. const src = `${origin}/instrument?platform=pc&modelType=practise&id=${props.item.content}&Authorization=${userStore.getToken}`;
  20. return () => (
  21. <div class={styles.musicScore}>
  22. <iframe
  23. ref={iframeRef}
  24. onLoad={() => {
  25. // emit('setIframe', iframeRef.value);
  26. isLoaded.value = true;
  27. }}
  28. class={[styles.container, 'musicIframe']}
  29. frameborder="0"
  30. src={src}></iframe>
  31. </div>
  32. );
  33. }
  34. });