完成右键菜单新建文件功能

This commit is contained in:
jmal 2020-07-17 10:33:04 +08:00
parent f08bb8e2f0
commit 1832a9d339
3 changed files with 11 additions and 15 deletions

View File

@ -31,7 +31,6 @@ export default {
},
watch: {
path(path){
console.log('path', path)
this.pathList = [{folder:'',path: '/'}]
let list = path.split('/').filter((item)=>item.length>0)
list.forEach((pathName,index)=>{

View File

@ -823,11 +823,6 @@
this.stompClient.unsubscribe()
}
},
// watch: {
// fileList: function (newValue,oldValue) {
// console.log(newValue,oldValue)
// }
// },
directives: {
// 注册一个局部的自定义指令 v-focus
focus: {
@ -861,7 +856,6 @@
this.stompClient = ws.stompClient.subscribe('/user/queue/update', (msg) => {
let fileDoc = JSON.parse(msg.body)
const url = msg.headers.url
console.log('onmessage.url', url, fileDoc)
let index = this.fileList.findIndex(file=>file.id === fileDoc.id)
if('updateFile' === url){
if(index > -1){
@ -1524,7 +1518,10 @@
this.textPreviewVisible = true
this.$message.success(`新建文件成功`)
this.newTextFileDialog = false
const that = this
setTimeout(function () {
that.newTextFileDialog = false
},200)
}).catch(()=>{
})
@ -2178,7 +2175,6 @@
}, 1000)
},
hide() {
console.log('菜单隐藏了')
const that = this
this.isJustHideMenus = true
setTimeout(function() {
@ -2188,7 +2184,6 @@
},
// 全局右键菜单操作
contextmenuClick(operation) {
console.log(operation)
switch (operation) {
case 'vmode-list':
this.grid=true;this.changeVmode()
@ -2460,7 +2455,6 @@
}).then((res) => {
data.newFolder = false
data.id = res.data.id
console.log(data)
}).catch(() => {
window.event.preventDefault()
window.event.stopPropagation()

View File

@ -204,7 +204,6 @@
},
watch: { //监听file的变化,进行相应的操作即可
file(file) {
console.log('watch file',file)
if(!file.path){
return
}
@ -239,7 +238,6 @@
if(!file.id){
request = 'previewTextByPath'
}
console.log(request,file)
api[request]({
shareId: this.shareId,
fileId: file.id,
@ -252,16 +250,21 @@
this.textPreviewVisible = true
this.content = res.data.contentText
let pathname = res.data.path.substring(1,res.data.path.length)+res.data.name
if('previewTextByPath' === request){
pathname = `/${res.data.path}/${res.data.name}`
}
// 加载tabs
this.editableTabs.push({
title: res.data.name,
copyTitle: res.data.name,
language: this.getEditorLanguage(res.data.suffix),
status: undefined,//标签状态
name: res.data.path.substring(1,res.data.path.length)+res.data.name,
name: pathname,
content: res.data.contentText
})
this.editableTabsValue = res.data.path.substring(1,res.data.path.length)+res.data.name
this.editableTabsValue = pathname
// 界面的渲染后的初始化工作
this.$nextTick(()=>{