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