diff --git a/src/military/components/ExportWord.js b/src/military/components/ExportWord.js index 59a9511f..10479c4b 100644 --- a/src/military/components/ExportWord.js +++ b/src/military/components/ExportWord.js @@ -38,7 +38,19 @@ class ExportWord extends Component { body: '_body_', }; - const activeDoc = document.getElementById(wordId).cloneNode(true); // 获取 dom 节点 + const activeDoc = document.getElementById(wordId); // 获取 dom 节点 + + if(activeDoc.querySelector(".markdown-body")){ + let imgNode =activeDoc.querySelectorAll('.markdown-body img'); + if(imgNode.length){ + for(const item of imgNode){ + let itemSrc=item.getAttribute('src'); + if(itemSrc.indexOf('http')===-1){ + item.setAttribute('src',location.origin+itemSrc); + } + } + } + } // 默认样式 const defaultStyle = '.text-div{ text-decoration: underline; margin-right: 15px; } .textarea-div{ text-decoration: underline; } table td,table th{padding: 6px 13px;border: 1px solid #ddd;} table{border-collapse: collapse;}';