| | |
| | | <template> |
| | | <div class="temp-book"> |
| | | <div class="temp-book" @mouseup="handleMouseUp"> |
| | | <pageHeader></pageHeader> |
| | | <pageContent></pageContent> |
| | | <!-- <examinations :questionList="cardList" :type="type"></examinations> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | getParentWithClass(element, className) { |
| | | while (element.parentElement) { |
| | | element = element.parentElement; |
| | | if (element.classList.contains(className)) { |
| | | return element; |
| | | } |
| | | } |
| | | }, |
| | | handleMouseUp(e) { |
| | | const txt = window.getSelection()?.toString(); |
| | | const node = window.getSelection(); |
| | | let html = node.anchorNode.parentNode.parentNode.parentNode; |
| | | let nextHtml = html.firstChild.innerHTML; |
| | | let pageHtml = this.getParentWithClass(node.anchorNode,'page-box') |
| | | if (txt) { |
| | | console.log(pageHtml); |
| | | } |
| | | if (html) { |
| | | const page = html.getAttribute("page"); |
| | | console.log("page", page,this.$actions); |
| | | this.$actions.setGlobalState({ |
| | | aa:page |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |