From a1f8fc2fdf89ab50cd46c5ad96f7fe3dbc333756 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期一, 13 五月 2024 14:53:23 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/home.vue | 72 ++++++++++++++++++++++-------------- 1 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/views/home.vue b/src/views/home.vue index 9ebb6a1..44c6920 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -302,12 +302,7 @@ <!-- 寰簲鐢ㄧ洅瀛� --> <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> @@ -871,13 +866,17 @@ 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 ) + +let microApp = null // 寰簲鐢ㄥ疄渚� onMounted(() => { - console.log(1111) // canvasWith.value = window.innerWidth - 540 // canvasheight.value = window.innerHeight - 110 getNotesList() // 鑾峰彇楂樹寒 @@ -901,11 +900,18 @@ })() } - 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, '瀛愬簲鐢ㄩ�夋嫨') } }) }) @@ -1085,7 +1091,17 @@ } //鍒锋柊褰撳墠椤甸潰 const reload = () => { - location.reload() + if (microApp) { + microApp.unmount() // 鍗歌浇寰簲鐢� + microApp = loadMicroApp(microApps.book1, { + sandbox: { + strictStyleIsolation: true, + experimentalStyleIsolation: true + } + }) + } else { + location.reload() + } } const selectResourceType = (type) => { @@ -1545,22 +1561,22 @@ } } -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 -- Gitblit v1.9.1