| | |
| | | <!-- 微应用盒子 --> |
| | | <div class="pageBox-content" @scroll="pageScroll"> |
| | | <div class="content-box"> |
| | | <div |
| | | id="container" |
| | | @mousedown="handleMouseDown" |
| | | @mousemove="handleMousemove" |
| | | @mouseup="handleMouseUp" |
| | | ></div> |
| | | <div id="container" @mousedown="handleMouseDown" @mousemove="handleMousemove"></div> |
| | | <!-- 画笔画布 --> |
| | | <div class="canvas-box" v-show="canvasShow"> |
| | | <canvas id="canvasRef" :width="canvasWith" :height="canvasheight"></canvas> |
| | |
| | | import { start } from 'qiankun' |
| | | import axios from 'axios' |
| | | import { fabric } from 'fabric' |
| | | |
| | | import { loadMicroApp } from 'qiankun' |
| | | import { microApps } from '@/child.ts' |
| | | const canvasWith = ref(1000) |
| | | const canvasheight = ref(3000) |
| | | const screenWidth = ref( |
| | | window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth |
| | | ) |
| | | onMounted(() => { |
| | | console.log(1111); |
| | | |
| | | let microApp = null // 微应用实例 |
| | | onMounted(() => { |
| | | // canvasWith.value = window.innerWidth - 540 |
| | | // canvasheight.value = window.innerHeight - 110 |
| | | getNotesList() // 获取高亮 |
| | |
| | | })() |
| | | } |
| | | |
| | | console.log(qiankunActions,"qiankunActions"); |
| | | // 加载微应用 |
| | | microApp = loadMicroApp(microApps.book1, { |
| | | sandbox: { |
| | | strictStyleIsolation: true, |
| | | experimentalStyleIsolation: true |
| | | } |
| | | }) |
| | | |
| | | qiankunActions.setGlobalState({ |
| | | cc: (data) => { |
| | | console.log(data); |
| | | window.qiankunActions.setGlobalState({ |
| | | state: 1, // 加载子应用 |
| | | windowSelection: (data) => { // 绑定子应用选择监听事件 |
| | | console.log(data, '子应用选择') |
| | | } |
| | | }) |
| | | }) |
| | |
| | | } |
| | | //刷新当前页面 |
| | | const reload = () => { |
| | | if (microApp) { |
| | | microApp.unmount() // 卸载微应用 |
| | | microApp = loadMicroApp(microApps.book1, { |
| | | sandbox: { |
| | | strictStyleIsolation: true, |
| | | experimentalStyleIsolation: true |
| | | } |
| | | }) |
| | | } else { |
| | | location.reload() |
| | | } |
| | | } |
| | | |
| | | const selectResourceType = (type) => { |
| | |
| | | } |
| | | } |
| | | |
| | | const handleMouseUp = (e) => { |
| | | if (move.value) { |
| | | const txt = window.getSelection()?.toString() |
| | | selectText.value = txt |
| | | const node = window.getSelection() |
| | | let html = node.anchorNode.parentNode.parentNode |
| | | dialogToolData.chapter = html.firstChild.innerHTML |
| | | if (txt) { |
| | | showToolBox.value = true |
| | | dialogToolData.top = e.y |
| | | dialogToolData.left = e.x |
| | | } |
| | | isMouseDown.value = false |
| | | } |
| | | move.value = false |
| | | } |
| | | // const handleMouseUp = (e) => { |
| | | // if (move.value) { |
| | | // const txt = window.getSelection()?.toString() |
| | | // selectText.value = txt |
| | | // const node = window.getSelection() |
| | | // let html = node.anchorNode.parentNode.parentNode |
| | | // dialogToolData.chapter = html.firstChild.innerHTML |
| | | // if (txt) { |
| | | // showToolBox.value = true |
| | | // dialogToolData.top = e.y |
| | | // dialogToolData.left = e.x |
| | | // } |
| | | // isMouseDown.value = false |
| | | // } |
| | | // move.value = false |
| | | // } |
| | | |
| | | const pageScroll = (e) => { |
| | | showToolBox.value = false |