perf: 按需加载富文本静态资源
This commit is contained in:
parent
76db0c41d3
commit
1fae364e7d
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="teditor-wrapper">
|
<div class="teditor-wrapper">
|
||||||
<input ref="input" class="teditor-bginput"/>
|
|
||||||
<div class="teditor-box" :class="[!inline && spinShow ? 'teditor-loadstyle' : 'teditor-loadedstyle']">
|
<div class="teditor-box" :class="[!inline && spinShow ? 'teditor-loadstyle' : 'teditor-loadedstyle']">
|
||||||
<template v-if="inline">
|
<template v-if="inline">
|
||||||
<div ref="myTextarea" :id="id" v-html="content"></div>
|
<div ref="myTextarea" :id="id" v-html="content"></div>
|
||||||
@ -351,11 +350,6 @@
|
|||||||
} else {
|
} else {
|
||||||
this.editor.setMode('design');
|
this.editor.setMode('design');
|
||||||
}
|
}
|
||||||
if (this.inline) {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.input.focus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.$emit('editorInit', this.editor);
|
this.$emit('editorInit', this.editor);
|
||||||
});
|
});
|
||||||
editor.on('KeyUp', (e) => {
|
editor.on('KeyUp', (e) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="file-content">
|
<div v-if="ready" class="file-content">
|
||||||
<iframe v-if="isPreview" ref="myPreview" class="preview-iframe" :src="previewUrl"></iframe>
|
<iframe v-if="isPreview" ref="myPreview" class="preview-iframe" :src="previewUrl"></iframe>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-show="!['word', 'excel', 'ppt'].includes(file.type)" class="edit-header">
|
<div v-show="!['word', 'excel', 'ppt'].includes(file.type)" class="edit-header">
|
||||||
@ -96,6 +96,8 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
ready: false,
|
||||||
|
|
||||||
loadContent: 0,
|
loadContent: 0,
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
|
|
||||||
@ -162,10 +164,11 @@ export default {
|
|||||||
|
|
||||||
value: {
|
value: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
if (!val) {
|
if (val) {
|
||||||
this.fileContent[this.fileId] = this.contentDetail;
|
this.ready = true;
|
||||||
} else {
|
|
||||||
this.editUser = [this.userId];
|
this.editUser = [this.userId];
|
||||||
|
} else {
|
||||||
|
this.fileContent[this.fileId] = this.contentDetail;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="task-add">
|
<div v-if="ready" class="task-add">
|
||||||
<div class="head" :class="{empty:addData.cascader.length == 0,visible:cascaderShow}">
|
<div class="head" :class="{empty:addData.cascader.length == 0,visible:cascaderShow}">
|
||||||
<Cascader
|
<Cascader
|
||||||
v-model="addData.cascader"
|
v-model="addData.cascader"
|
||||||
@ -116,11 +116,11 @@
|
|||||||
<ButtonGroup class="page-manage-add-task-button-group">
|
<ButtonGroup class="page-manage-add-task-button-group">
|
||||||
<Button type="primary" :loading="loadIng > 0" @click="onAdd">{{$L('添加任务')}}</Button>
|
<Button type="primary" :loading="loadIng > 0" @click="onAdd">{{$L('添加任务')}}</Button>
|
||||||
<Dropdown @on-click="onAdd(true)">
|
<Dropdown @on-click="onAdd(true)">
|
||||||
<Button type="primary" :loading="loadIng > 0">
|
<Button type="primary">
|
||||||
<Icon type="ios-arrow-down"></Icon>
|
<Icon type="ios-arrow-down"></Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<DropdownMenu slot="list">
|
<DropdownMenu slot="list">
|
||||||
<DropdownItem>{{$L('提交继续添加')}}</DropdownItem>
|
<DropdownItem :disabled="loadIng > 0">{{$L('提交继续添加')}}</DropdownItem>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
@ -145,6 +145,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
ready: false,
|
||||||
|
|
||||||
addData: {
|
addData: {
|
||||||
cascader: [],
|
cascader: [],
|
||||||
name: "",
|
name: "",
|
||||||
@ -207,9 +209,12 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
value(val) {
|
value(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
this.ready = true;
|
||||||
this.initCascaderData();
|
this.initCascaderData();
|
||||||
this.initProjectData();
|
this.initProjectData();
|
||||||
this.$nextTick(this.$refs.input.focus)
|
this.$nextTick(() => {
|
||||||
|
this.$refs.input.focus()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'addData.project_id'(id) {
|
'addData.project_id'(id) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!--子任务-->
|
<!--子任务-->
|
||||||
<li v-if="taskDetail.parent_id > 0">
|
<li v-if="ready && taskDetail.parent_id > 0">
|
||||||
<div class="subtask-icon">
|
<div class="subtask-icon">
|
||||||
<div v-if="taskDetail.loading === true" class="loading"><Loading /></div>
|
<div v-if="taskDetail.loading === true" class="loading"><Loading /></div>
|
||||||
<EDropdown
|
<EDropdown
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</Poptip>
|
</Poptip>
|
||||||
</li>
|
</li>
|
||||||
<!--主任务-->
|
<!--主任务-->
|
||||||
<div v-else v-show="taskDetail.id > 0" :class="{'task-detail':true, 'open-dialog': hasOpenDialog, 'completed': taskDetail.complete_at}">
|
<div v-else-if="ready" v-show="taskDetail.id > 0" :class="{'task-detail':true, 'open-dialog': hasOpenDialog, 'completed': taskDetail.complete_at}">
|
||||||
<div class="task-info">
|
<div class="task-info">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<Icon v-if="taskDetail.complete_at" class="icon completed" type="md-checkmark-circle" @click="updateData('uncomplete')"/>
|
<Icon v-if="taskDetail.complete_at" class="icon completed" type="md-checkmark-circle" @click="updateData('uncomplete')"/>
|
||||||
@ -154,7 +154,6 @@
|
|||||||
<div class="desc">
|
<div class="desc">
|
||||||
<TEditor
|
<TEditor
|
||||||
ref="desc"
|
ref="desc"
|
||||||
v-if="loadEditor"
|
|
||||||
:value="taskContent"
|
:value="taskContent"
|
||||||
:plugins="taskPlugins"
|
:plugins="taskPlugins"
|
||||||
:options="taskOptions"
|
:options="taskOptions"
|
||||||
@ -422,8 +421,9 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
ready: false,
|
||||||
|
|
||||||
taskDetail: {},
|
taskDetail: {},
|
||||||
loadEditor: false,
|
|
||||||
|
|
||||||
ownerShow: false,
|
ownerShow: false,
|
||||||
ownerData: {},
|
ownerData: {},
|
||||||
@ -695,9 +695,7 @@ export default {
|
|||||||
},
|
},
|
||||||
taskId (id) {
|
taskId (id) {
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
this.$nextTick(() => {
|
this.ready = true;
|
||||||
this.loadEditor = true;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.timeOpen = false;
|
this.timeOpen = false;
|
||||||
this.timeForce = false;
|
this.timeForce = false;
|
||||||
|
@ -199,7 +199,7 @@
|
|||||||
v-model="editShow"
|
v-model="editShow"
|
||||||
class="page-file-drawer"
|
class="page-file-drawer"
|
||||||
:mask-closable="false">
|
:mask-closable="false">
|
||||||
<FileContent v-if="editNum > 0" v-model="editShow" :file="editInfo"/>
|
<FileContent v-model="editShow" :file="editInfo"/>
|
||||||
</DrawerOverlay>
|
</DrawerOverlay>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -289,7 +289,6 @@ export default {
|
|||||||
shareInfo: {},
|
shareInfo: {},
|
||||||
shareLoad: 0,
|
shareLoad: 0,
|
||||||
|
|
||||||
editNum: 0, // 此参数是为了判断首次打开文件再加载文件组件
|
|
||||||
editShow: false,
|
editShow: false,
|
||||||
editInfo: {},
|
editInfo: {},
|
||||||
|
|
||||||
@ -397,7 +396,6 @@ export default {
|
|||||||
|
|
||||||
editShow(val) {
|
editShow(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.editNum++;
|
|
||||||
this.$store.dispatch("websocketPath", "file/content/" + this.editInfo.id);
|
this.$store.dispatch("websocketPath", "file/content/" + this.editInfo.id);
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch("websocketPath", "file");
|
this.$store.dispatch("websocketPath", "file");
|
||||||
|
10
resources/assets/sass/components/t-editor.scss
vendored
10
resources/assets/sass/components/t-editor.scss
vendored
@ -7,16 +7,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.teditor-bginput {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
opacity: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
z-index: -999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.teditor-box {
|
.teditor-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user