14
14
<div class =" body" >
15
15
<el-row >
16
16
<!-- v-bind:style="{ width: detailWidth + 'px' }" -->
17
- <el-col id =" menu" class =" left" :span =" 5 "
17
+ <el-col id =" menu" class =" left" :span =" menu_span "
18
18
>
19
19
<div class =" bg-purple" >
20
20
<el-input
34
34
</el-tree >
35
35
</div ></el-col
36
36
>
37
- <el-col id =" content" class =" right" :span =" 19 "
37
+ <el-col id =" content" :style = " { 'padding-left' : content_left_padding+'px'} " class =" right" :span =" content_span "
38
38
><div class =" bg-purple-light" >
39
39
<mavon-editor
40
40
:toolbars =" markdownOption"
@@ -69,10 +69,13 @@ export default {
69
69
title: " Obsidian Web" ,
70
70
keyword: " " ,
71
71
detailWidth: ' 300' ,
72
+ menu_span: 5 ,
73
+ content_span: 19 ,
74
+ content_left_padding: 20 ,
72
75
};
73
76
},
74
77
mounted () {
75
-
78
+ this . resize ();
76
79
var index= ' index.md'
77
80
if (this .$route .query .path ){
78
81
index = this .$route .query .path ;
@@ -81,15 +84,13 @@ export default {
81
84
axios .get (this .server + " /list" ).then (resp => {
82
85
console .log (" send requests" );
83
86
this .filelist = [];
84
- this .filelist .push ({
85
- label: " 首页" ,
86
- name: " 首页" ,
87
- fullpath: index,
88
- type: " file"
89
- });
90
87
this .filelist = this .filelist .concat (resp .data .nodes );
91
88
this .fulllist = this .filelist ;
92
89
this .title = resp .data .title ;
90
+ if (index){
91
+ const filename = index .split (' /' );
92
+ this .title = filename[filename .length - 1 ]
93
+ }
93
94
});
94
95
this .readFile (index)
95
96
// this.dragControllerDiv()
@@ -115,6 +116,13 @@ export default {
115
116
}
116
117
},
117
118
methods: {
119
+ resize (){
120
+ if (screen .width < screen .height ){
121
+ this .menu_span = 0 ;
122
+ this .content_span = 24
123
+ this .content_left_padding = 0
124
+ }
125
+ },
118
126
readFile (path ){
119
127
axios .get (this .server + " /files/" + encodeURIComponent (path)).then (resp => {
120
128
// var html=resp.data.text;
@@ -268,7 +276,6 @@ export default {
268
276
max-height : 730px ;
269
277
height : 730px ;
270
278
overflow : hidden ;
271
- padding-left : 20px ;
272
279
padding-right : 20px ;
273
280
scrollbar-width : none ;
274
281
0 commit comments