按需加载代码部分修改,聊天头像太大改成按需加载、行编辑的组件引入导致全局注册整个form

pull/755/head
zhangdaiscott 2023-08-26 15:50:50 +08:00
parent 50c1f2362f
commit 7d05d7f6fd
7 changed files with 43 additions and 23 deletions

View File

@ -30,7 +30,8 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent } from 'vue'; import { computed, defineComponent } from 'vue';
import { JSelectDept } from '/@/components/Form'; //import { JSelectDept } from '/@/components/Form';
import JSelectDept from '/src/components/form/src/jeecg/components/JSelectDept.vue';
import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types'; import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks'; import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';

View File

@ -3,7 +3,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, ref } from 'vue'; import { computed, defineComponent, ref } from 'vue';
import { JPopup } from '/@/components/Form'; //import { JPopup } from '/@/components/Form';
import JPopup from '/src/components/form/src/jeecg/components/JPopup.vue';
import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types'; import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks'; import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
import { dispatchEvent, vModel } from '/@/components/jeecg/JVxeTable/utils'; import { dispatchEvent, vModel } from '/@/components/jeecg/JVxeTable/utils';

View File

@ -6,7 +6,8 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent } from 'vue'; import { computed, defineComponent } from 'vue';
import { JSelectUser } from '/@/components/Form'; //import { JSelectUser } from '/@/components/Form';
import JSelectUser from '/src/components/form/src/jeecg/components/JSelectUser.vue';
import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types'; import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks'; import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
import { dispatchEvent } from '/@/components/jeecg/JVxeTable/utils'; import { dispatchEvent } from '/@/components/jeecg/JVxeTable/utils';

View File

@ -88,7 +88,7 @@
import { Comment, Tooltip } from 'ant-design-vue'; import { Comment, Tooltip } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import MyComment from './MyComment.vue'; import MyComment from './MyComment.vue';
import { list, saveOne, deleteOne, useCommentWithFile, useEmojiHtml, queryById } from './useComment'; import { list, saveOne, deleteOne, useCommentWithFile, useEmojiHtml, queryById, getGloablEmojiIndex } from './useComment';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import HistoryFileList from './HistoryFileList.vue'; import HistoryFileList from './HistoryFileList.vue';
import { Popconfirm } from 'ant-design-vue'; import { Popconfirm } from 'ant-design-vue';

View File

@ -53,7 +53,7 @@
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import UploadChunk from './UploadChunk.vue'; import UploadChunk from './UploadChunk.vue';
import 'emoji-mart-vue-fast/css/emoji-mart.css'; import 'emoji-mart-vue-fast/css/emoji-mart.css';
import { useEmojiHtml } from './useComment'; import { getGloablEmojiIndex, useEmojiHtml } from './useComment';
const optionsName = { const optionsName = {
categories: { categories: {

View File

@ -13,6 +13,8 @@ import txt from '/@/assets/svg/fileType/txt.svg';
import word from '/@/assets/svg/fileType/word.svg'; import word from '/@/assets/svg/fileType/word.svg';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { createImgPreview } from '/@/components/Preview'; import { createImgPreview } from '/@/components/Preview';
import data from "emoji-mart-vue-fast/data/apple.json";
import { EmojiIndex } from "emoji-mart-vue-fast/src";
enum Api { enum Api {
list = '/sys/comment/listByForm', list = '/sys/comment/listByForm',
@ -38,6 +40,21 @@ const getViewFileDomain = () => defHttp.get({ url: Api.getFileViewDomain });
*/ */
export const list = (params) => defHttp.get({ url: Api.list, params }); export const list = (params) => defHttp.get({ url: Api.list, params });
export function getGloablEmojiIndex(){
if(window['myEmojiIndex']){
console.log("----走window['myEmojiIndex']缓存不new新对象")
return window['myEmojiIndex'];
}
window['myEmojiIndex'] = new EmojiIndex(data, {
function() {
return true;
},
exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags']
});
return window['myEmojiIndex'];
}
/** /**
* *
* @param params * @param params

View File

@ -2,10 +2,10 @@ import type { App } from 'vue';
import { registerJVxeTable } from '/@/components/jeecg/JVxeTable'; import { registerJVxeTable } from '/@/components/jeecg/JVxeTable';
import { registerJVxeCustom } from '/@/components/JVxeCustom'; import { registerJVxeCustom } from '/@/components/JVxeCustom';
// 注册全局聊天表情包 // // 注册全局聊天表情包
import { Picker } from 'emoji-mart-vue-fast/src'; // import { Picker } from 'emoji-mart-vue-fast/src';
import { EmojiIndex } from "emoji-mart-vue-fast/src"; // import { EmojiIndex } from "emoji-mart-vue-fast/src";
import data from "emoji-mart-vue-fast/data/apple.json"; // import data from "emoji-mart-vue-fast/data/apple.json";
// 注册全局dayjs // 注册全局dayjs
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -17,23 +17,23 @@ export async function registerThirdComp(app: App) {
registerJVxeTable(app); registerJVxeTable(app);
// 注册 JVxeTable 自定义组件 // 注册 JVxeTable 自定义组件
await registerJVxeCustom(); await registerJVxeCustom();
//--------------------------------------------------------------------- // //---------------------------------------------------------------------
// 注册全局聊天表情包 // // 注册全局聊天表情包
app.component('Picker', Picker); // app.component('Picker', Picker);
let myEmojiIndex = new EmojiIndex(data, { // let myEmojiIndex = new EmojiIndex(data, {
function() { // function() {
return true; // return true;
}, // },
exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags'] // exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags']
}); // });
app.config.globalProperties.$globalEmojiIndex = myEmojiIndex // app.config.globalProperties.$globalEmojiIndex = myEmojiIndex;
app.provide('$globalEmojiIndex', myEmojiIndex) // app.provide('$globalEmojiIndex', myEmojiIndex);
//--------------------------------------------------------------------- // //---------------------------------------------------------------------
// 注册全局dayjs // 注册全局dayjs
dayjs.locale('zh-cn'); dayjs.locale('zh-cn');
dayjs.extend(relativeTime); dayjs.extend(relativeTime);
dayjs.extend(customParseFormat); dayjs.extend(customParseFormat);
app.config.globalProperties.$dayjs = dayjs app.config.globalProperties.$dayjs = dayjs;
app.provide('$dayjs', dayjs) app.provide('$dayjs', dayjs);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
} }