diff --git a/src/App.vue b/src/App.vue index a84e60b..256b959 100644 --- a/src/App.vue +++ b/src/App.vue @@ -332,6 +332,7 @@ $tag-width: 170px; .view-container-item { flex: 1; height: 100%; + min-width: 0; } &::-webkit-scrollbar { diff --git a/src/hooks/init.ts b/src/hooks/init.ts index b36e1ee..781a206 100644 --- a/src/hooks/init.ts +++ b/src/hooks/init.ts @@ -42,16 +42,22 @@ export default function init() { 'miaoIframe', '框架', MiaoIframe, - (vDirs, vFiles) => { + () => { return false } ) pluginCenter.registerComponent( 'miaoPDF', - 'PDF', + 'PDF浏览', MiaoPDF, (vDirs, vFiles) => { - return true + if (vDirs.length !== 0) { + return false + } + if (vFiles.length !== 1) { + return false + } + return vFiles[0].name.endsWith('pdf') } ) } diff --git a/src/views/miaoPDF.vue b/src/views/miaoPDF.vue index 039b18f..62dda0d 100644 --- a/src/views/miaoPDF.vue +++ b/src/views/miaoPDF.vue @@ -1,13 +1,24 @@ @@ -58,22 +100,75 @@ onMounted(async () => { width: 100%; height: 100%; background-color: rgb(53, 53, 53); + overflow-y: hidden; + display: flex; + flex-direction: column; + align-items: center; + + .miao-container-topBar { + box-sizing: border-box; + padding: 0 30px; + height: 30px; + width: 100%; + background-color: rgb(170, 176, 182); + display: flex; + justify-content: space-around; + align-items: center; + + &-btn { + cursor: pointer; + user-select: none; + height: 80%; + padding: 0 5px; + display: flex; + align-items: center; + justify-content: center; + font-size: larger; + letter-spacing: 1px; + color: black; + border-radius: 5px; + + &:hover { + background-color: #eaeaea42; + } + } + } + .miao-container-pdf { + min-width: 0; max-width: 100%; max-height: 100%; - overflow: scroll; display: flex; flex-direction: column; - align-items: center; + + .page { + display: flex; + justify-content: center; + align-items: center; + transform: scale(0.5); + } + + canvas { + width: 100%; + height: 100%; + border-bottom: 1px solid black; + } } - .page { + + .miao-container-loading { + position: absolute; + top: 40px; + background-color: aliceblue; + border: 1px solid black; + height: 40px; + width: 400px; + border-radius: 10px; display: flex; justify-content: center; align-items: center; - } - canvas { - width: 100%; - height: 100%; + font-size: 20px; + letter-spacing: 5px; + user-select: none; } }