优化可配置爬虫前端界面

This commit is contained in:
marvzhang
2019-11-28 21:36:17 +08:00
parent bc81462a80
commit ba4f5fd20c
11 changed files with 186 additions and 93 deletions

View File

@@ -18,6 +18,7 @@ import 'codemirror/mode/go/go.js'
import 'codemirror/mode/shell/shell.js'
import 'codemirror/mode/markdown/markdown.js'
import 'codemirror/mode/php/php.js'
import 'codemirror/mode/yaml/yaml.js'
export default {
name: 'FileDetail',
@@ -38,7 +39,7 @@ export default {
},
options () {
return {
mode: this.lanaguage,
mode: this.language,
theme: 'darcula',
styleActiveLine: true,
lineNumbers: true,
@@ -46,8 +47,9 @@ export default {
matchBrackets: true
}
},
lanaguage () {
language () {
const fileName = this.$store.state.file.currentPath
if (!fileName) return ''
if (fileName.match(/\.js$/)) {
return 'text/javascript'
} else if (fileName.match(/\.py$/)) {
@@ -60,6 +62,8 @@ export default {
return 'text/x-php'
} else if (fileName.match(/\.md$/)) {
return 'text/x-markdown'
} else if (fileName === 'Spiderfile') {
return 'text/x-yaml'
} else {
return 'text'
}
@@ -74,7 +78,7 @@ export default {
<style scoped>
.file-content {
border: 1px solid #eaecef;
height: 480px;
height: calc(100vh - 256px);
}
.file-content >>> .CodeMirror {

View File

@@ -120,6 +120,8 @@ export default {
this.showFile = false
this.onBack()
}
},
created () {
}
}
</script>