4343 </div >
4444
4545 <div class =" body" >
46- <div class =" left" v-show =" left.outline" >
46+ <div class =" left" v-show =" left.outline" :style = " { width: `${left.width}px` } " >
4747 <el-tree
4848 :data =" outline"
4949 :props =" { children: 'items', label: 'title' }"
5050 :expand-on-click-node =" false"
5151 @node-click =" outlineClick"
5252 />
53+
54+ <ClickMove @move =" (v) => changeLeftWidth(v.x)" />
5355 </div >
5456 <div class =" right" >
5557 <div class =" pages" ref =" views" @scroll =" onScroll" >
@@ -75,6 +77,8 @@ import { debounce } from 'lodash'
7577import * as pdfjsLib from ' pdfjs-dist'
7678import workerUrl from ' pdfjs-dist/build/pdf.worker.min.mjs?url'
7779
80+ import ClickMove from ' @/components/ClickMove.vue'
81+
7882import { getFullPath } from ' @/utils/file'
7983import type { TreeNodeData } from ' element-plus'
8084
@@ -88,7 +92,7 @@ interface OutlineModel {
8892
8993const $props = defineProps <{ src: string }>()
9094
91- const left = ref ({ outline: true })
95+ const left = ref ({ outline: true , width: 240 })
9296
9397const pdf = ref <pdfjsLib .PDFDocumentProxy >()
9498const params = ref ({ dpr: 1 , width: 0 , height: 0 })
@@ -196,6 +200,16 @@ const outlineClick = async (data: TreeNodeData) => {
196200 changeCur (page + 1 )
197201 }
198202}
203+
204+ const changeLeftWidth = (v : number ) => {
205+ const newVal = left .value .width + v
206+
207+ if (newVal > 500 || newVal < 200 ) {
208+ return
209+ }
210+
211+ left .value .width = newVal
212+ }
199213 </script >
200214
201215<style lang="scss" scoped>
@@ -235,7 +249,6 @@ const outlineClick = async (data: TreeNodeData) => {
235249
236250 > .left {
237251 position : relative ;
238- width : 300px ;
239252 border-right : 1px solid var (--el-border-color );
240253
241254 > .el-tree {
@@ -246,6 +259,20 @@ const outlineClick = async (data: TreeNodeData) => {
246259 width : 100% ;
247260 overflow : auto ;
248261 }
262+
263+ > .click-move {
264+ position : absolute ;
265+ top : 0 ;
266+ bottom : 0 ;
267+ right : 0 ;
268+ width : 7px ;
269+ transform : translateX (4px );
270+ cursor : e-resize ;
271+
272+ & :hover {
273+ background-color : var (--el-text-color-placeholder );
274+ }
275+ }
249276 }
250277
251278 > .right {
0 commit comments