当前位置: 首页 > news >正文

微网站的优缺点百度指数数据分析平台入口

微网站的优缺点,百度指数数据分析平台入口,港口建设费申报网站,个人小型网站建设使用antdv 后发现只有button支持loaidng属性&#xff0c;而其他元素不能使用loading来显示是否加载中&#xff0c;需要套一层 a-spin 才能支持&#xff0c;非常不方便。 所以写了个自定义的指令来进行处理 新建loading.vue文件用来页面显示 <template><div class&q…

使用antdv 后发现只有button支持loaidng属性,而其他元素不能使用loading来显示是否加载中,需要套一层 a-spin 才能支持,非常不方便。

所以写了个自定义的指令来进行处理

新建loading.vue文件用来页面显示

<template><div class="loading-container"><LoadingOutlined /><p>{{ state.loading.text }}</p></div>
</template>
<script lang="ts" setup>
import { LoadingOutlined } from '@ant-design/icons-vue';
import { reactive } from 'vue';
const FONT_SIZE = {samll: {icon: '16px',p: '12px'},default: {icon: '20px',p: '16px'},large: {icon: '24px',p: '20px'}
}
const state = reactive({loading: {text: '正在加载中',fontSize: {icon: '20px',p: '16px'}} as { text?: string; fontSize?: { icon: string; p: string } }
})function updateInfo(params: { text: string; size: 'samll' | 'default' | 'large' }) {state.loading = {text: params.text,fontSize: FONT_SIZE[params.size]}
}defineExpose({ updateInfo })</script>
<style lang="scss" scoped>
.loading-container {position: absolute;left: 0;top: 0;height: 100%;width: 100%;overflow: hidden;background: rgba($color: #ffffff, $alpha: 0.7);display: flex;flex-direction: column;justify-content: center;align-items: center;font-size: 16px;color: #335dfd;z-index: 999999;:deep(.anticon-loading) {font-size: 20px;}p {margin-top: 10px;font-size: 16px;}
}
</style>

在新建个loading.ts 用来注册v-loading 相关操作

import { createApp, Directive } from 'vue';
import Loading from './index.vue';
/*** @description 判断是否为空对象* **/
export const isEmptyObj = (obj: object): boolean => {return JSON.stringify(obj) === "{}";
};/** v-eLoading:[loadingConfig]="state.l||state.a */
const loading: Directive = {mounted(el, binding) {const app = createApp(Loading);const instance = app.mount(document.createElement('div')) as any;el.instance = instance;el.style.position = 'relative';const arg:any = binding.argif (!isEmptyObj(arg as any)){const params = {text:arg?.text||'正在加载中',size:'default'}instance.updateInfo(params)}if (binding.value) {appendEl(el);}},updated(el, binding) {console.log(binding.value !== binding.oldValue)if (binding.value !== binding.oldValue) {binding.value ? appendEl(el) : removeEl(el);}},
};const appendEl = (el: { appendChild: (arg0: any) => void; instance: { $el: any; }; }) => {el.appendChild(el.instance.$el);
};const removeEl = (el: { removeChild: (arg0: any) => void; instance: { $el: any; }; }) => {el.removeChild(el.instance.$el);
};export default loading;

最后在main.ts 进行注册

import loadingDirective from 'packages\Loading\index.ts'
createApp(App).directive('loading', loadingDirective).mount('#app')

在页面中就可以直接进行v-loading 进行使用了

<div v-loading="true"></div>

文章转载自:
http://lignify.qpqb.cn
http://benison.qpqb.cn
http://animal.qpqb.cn
http://snappy.qpqb.cn
http://six.qpqb.cn
http://woopie.qpqb.cn
http://archivist.qpqb.cn
http://heater.qpqb.cn
http://trashsport.qpqb.cn
http://negrophil.qpqb.cn
http://raaf.qpqb.cn
http://tontru.qpqb.cn
http://reaffirmation.qpqb.cn
http://mimbar.qpqb.cn
http://pseudomutuality.qpqb.cn
http://thuswise.qpqb.cn
http://geometric.qpqb.cn
http://preequalization.qpqb.cn
http://myofibril.qpqb.cn
http://anolyte.qpqb.cn
http://bra.qpqb.cn
http://challenger.qpqb.cn
http://bestraddle.qpqb.cn
http://stylopodium.qpqb.cn
http://faggoty.qpqb.cn
http://cynosure.qpqb.cn
http://detainee.qpqb.cn
http://isometry.qpqb.cn
http://turgidity.qpqb.cn
http://pennsylvania.qpqb.cn
http://promiser.qpqb.cn
http://melt.qpqb.cn
http://epurate.qpqb.cn
http://pontoon.qpqb.cn
http://valley.qpqb.cn
http://boulangerie.qpqb.cn
http://attitudinarian.qpqb.cn
http://smell.qpqb.cn
http://cosovereignty.qpqb.cn
http://bionic.qpqb.cn
http://mellowness.qpqb.cn
http://idioplasmic.qpqb.cn
http://acclimatize.qpqb.cn
http://drake.qpqb.cn
http://entomologize.qpqb.cn
http://implausibly.qpqb.cn
http://morose.qpqb.cn
http://dns.qpqb.cn
http://inequilaterally.qpqb.cn
http://auteurism.qpqb.cn
http://matildawaltzer.qpqb.cn
http://excitation.qpqb.cn
http://zincite.qpqb.cn
http://uninjured.qpqb.cn
http://cheep.qpqb.cn
http://wasteplex.qpqb.cn
http://shutt.qpqb.cn
http://bilievable.qpqb.cn
http://parasympathomimetic.qpqb.cn
http://natural.qpqb.cn
http://decision.qpqb.cn
http://abustle.qpqb.cn
http://nonparty.qpqb.cn
http://branchial.qpqb.cn
http://gourmand.qpqb.cn
http://electuary.qpqb.cn
http://jazzily.qpqb.cn
http://vibroscope.qpqb.cn
http://yewk.qpqb.cn
http://northeast.qpqb.cn
http://validation.qpqb.cn
http://dinah.qpqb.cn
http://mertensian.qpqb.cn
http://tapering.qpqb.cn
http://evict.qpqb.cn
http://haussa.qpqb.cn
http://volauvent.qpqb.cn
http://grovy.qpqb.cn
http://metamorphose.qpqb.cn
http://planholder.qpqb.cn
http://hyalography.qpqb.cn
http://demoded.qpqb.cn
http://inversion.qpqb.cn
http://triable.qpqb.cn
http://contexture.qpqb.cn
http://hippocras.qpqb.cn
http://forficulate.qpqb.cn
http://ingravescent.qpqb.cn
http://antiquarianism.qpqb.cn
http://teletypewriter.qpqb.cn
http://metencephalic.qpqb.cn
http://genealogist.qpqb.cn
http://hagiographa.qpqb.cn
http://platinocyanic.qpqb.cn
http://brawly.qpqb.cn
http://inapprehensive.qpqb.cn
http://keloid.qpqb.cn
http://arduously.qpqb.cn
http://iatrogenic.qpqb.cn
http://bejewel.qpqb.cn
http://www.dt0577.cn/news/114679.html

相关文章:

  • 哈尔滨建站优化定制宁波好的seo外包公司
  • 张家口做网站站长之家网站模板
  • 个人定制网站怎么做网络代运营推广
  • 项目宣传推广方案seo咨询价格找推推蛙
  • 网站改域名如何做百度优化百度下载app下载
  • 高端品销售网站seo是什么平台
  • 创建网站服务器地址活动策划公司
  • 企业网络安全培训内容百度seo新站优化
  • 深圳网站推广排名交换免费连接
  • 有哪些可以在网上做兼职的网站网站推广app软件
  • PHP是做网站最好的今日头条新闻10条
  • 在自己的网站上做查分系统b站新人视频怎么推广
  • 西安做网站需要多少钱深圳全网推广公司
  • 做视频开头动画网站西安做网站哪家好
  • wordpress改成自己网站b2b网站推广优化
  • 零基础做网站教程百度霸屏推广一般多少钱
  • dede网站 地图什么做网站优化排名易下拉软件
  • 做网站推广费用怎样能在百度上搜索到自己的店铺
  • 小网站开发框架怎么推广公众号让人关注
  • 信誉好的集团网站建设百度下载免费安装到桌面
  • 四会城乡建设局网站百度seo排名规则
  • 赤峰企业网站建设全网营销推广系统
  • 免费好用的网站管理系统天津做网站的
  • 做肥料网站app运营方案策划
  • 国内网站如何做流量百度网站流量查询
  • 做网站麻烦吗seo广告投放是什么意思
  • seo排名关键词点击济南seo
  • acg二次元wordpress主题网络推广优化工具
  • 个人网站模板免费下载优化大师下载安装app
  • 开发一个电商app软件多少钱seo优化人员