vue3 懒加载第三方组件

项目导入了tdesign的color-picker组件,为了减少每次加载时间,用到在加载,从手动导入改为懒加载

相关代码:

html 复制代码
<TColorPicker v-model="item.color" @change="clickStyle" @palette-bar-change="paletteBarChange" borderless enableAlpha :recentColors="false" :swatch-colors="false" style="margin-top: -5px;" />

import { defineAsyncComponent } from 'vue'

const TColorPicker = defineAsyncComponent(() => import('tdesign-vue-next').then(module => {
  import('tdesign-vue-next/es/style/index.css');
  return module.ColorPicker;
}));

export default {
  components: {
    TColorPicker
  },
}
相关推荐
kyriewen9 小时前
我把最常踩的8个CORS跨域报错整理了一遍——第8个去年还不存在
前端·javascript
NeilCarmack13 小时前
Deepseek-harness增加桌面版端序列:第 2 讲 · spawn Electron:当前进程如何“交棒“
前端·javascript·electron
এ慕ོ冬℘゜16 小时前
使用 jQuery 动态渲染表格与状态切换
前端·javascript·jquery
智购科技自动售货机厂家17 小时前
2026自动售货机AI视觉识别优化:从YOLOv11n模型量化到RKNN部署的端侧推理工程实践~YH
javascript·人工智能·yolo·机器学习·计算机视觉·目标跟踪·perl
晓说前端17 小时前
TypeScript 核心语法应用 —— Vue 3 中的使用(下)
前端·javascript·typescript·类型系统
lancyu20 小时前
# Agent Loop:AI Agent 的唯一直心骨
开发语言·javascript·人工智能
半个落月21 小时前
JavaScript 单例模式详解:从唯一实例到按钮事件
javascript
weixin_BYSJ19871 天前
springboot智慧公共交通系统---附源码51123
java·javascript·spring boot·python·django·flask·php
sir.山1 天前
在 Vue 3 项目中使用 Mock 数据
前端·vue.js·vue3·vite