做网站主要来源,天河网站建设外包,做建材交易网站的上市公司,网站开发过程说明怎么写效果如下图#xff1a;在线预览 APIs
参数说明类型默认值必传animated是否展示动画效果booleantruefalsebutton是否使用按钮占位图boolean | SkeletonButtonPropsfalsefalseavatar是否显示头像占位图boolean | SkeletonAvatarPropsfalsefalseinput是否使用输入框占位图boolea…效果如下图在线预览 APIs
参数说明类型默认值必传animated是否展示动画效果booleantruefalsebutton是否使用按钮占位图boolean | SkeletonButtonPropsfalsefalseavatar是否显示头像占位图boolean | SkeletonAvatarPropsfalsefalseinput是否使用输入框占位图boolean | SkeletonInputPropsfalsefalseimage是否使用图像占位图booleanfalsefalsetitle是否显示标题占位图boolean | SkeletonTitlePropstruefalseparagraph是否显示段落占位图boolean | SkeletonParagraphPropstruefalseloading为 true 时显示占位图反之则直接展示子组件booleantruefalse
SkeletonButtonProps Type
名称说明类型必传shape指定按钮的形状‘default’ | ‘round’ | ‘circle’falsesize设置按钮的大小‘default’ | ‘small’ | ‘large’falseblock将按钮宽度调整为其父宽度的选项booleanfalse
SkeletonAvatarProps Type
名称说明类型必传shape指定头像的形状‘circle’ | ‘square’falsesize设置头像占位图的大小number | ‘default’ | ‘small’ | ‘large’false
SkeletonInputProps Type
名称说明类型必传size设置输入框的大小‘default’ | ‘small’ | ‘large’false
SkeletonTitleProps Type
名称说明类型必传width设置标题占位图的宽度number | stringfalse
SkeletonParagraphProps Type
名称说明类型必传rows设置段落占位图的行数number | stringfalsewidth设置段落占位图的宽度若为数组时则为对应的每行宽度反之则是最后一行的宽度number | string | Arraynumber|stringfalse
创建骨架屏组件Skeleton.vue
script setup langts
import { computed } from vueinterface SkeletonButtonProps {shape?: default|round|circle // 指定按钮的形状size?: default|small|large // 设置按钮的大小block?: boolean // 将按钮宽度调整为其父宽度的选项
}
interface SkeletonAvatarProps {shape?: circle|square // 指定头像的形状size?: number|default|small|large // 设置头像占位图的大小
}
interface SkeletonInputProps {size: default|small|large // 设置输入框的大小
}
interface SkeletonTitleProps {width?: number|string // 设置标题占位图的宽度
}
interface SkeletonParagraphProps {rows?: number|string // 设置段落占位图的行数width?: number|string|Arraynumber|string // 设置段落占位图的宽度若为数组时则为对应的每行宽度反之则是最后一行的宽度
}
interface Props {animated?: boolean // 是否展示动画效果button?: boolean|SkeletonButtonProps // 是否使用按钮占位图avatar?: boolean|SkeletonAvatarProps // 是否显示头像占位图input?: boolean|SkeletonInputProps // 是否使用输入框占位图image?: boolean // 是否使用图像占位图title?: boolean|SkeletonTitleProps // 是否显示标题占位图paragraph?: boolean|SkeletonParagraphProps // 是否显示段落占位图loading?: boolean // 为 true 时显示占位图反之则直接展示子组件
}
const props withDefaults(definePropsProps(), {animated: true,button: false,image: false,avatar: false,input: false,title: true,paragraph: true,loading: true
})
const buttonSize computed(() {if (typeof props.button object) {if (props.button.size large) {return 40}if (props.button.size small) {return 24}return 32}
})
const titleTop computed(() {if (typeof props.avatar boolean) {return 8} else {if (typeof props.avatar.size number) {return (props.avatar.size - 16) / 2} else {const topMap {default: 8,small: 4,large: 12}return topMap[props.avatar.size || default]}}
})
const titleWidth computed(() {if (typeof props.title boolean) {return 38%} else {if (typeof props.title.width number) {return props.title.width px}return props.title.width || 38%}
})
const paragraphRows computed(() {if (typeof props.paragraph boolean) {return 3}return props.paragraph.rows
})
const paragraphWidth computed(() {if (typeof props.paragraph boolean) {return Array(paragraphRows.value)} else {if (Array.isArray(props.paragraph.width)) {return props.paragraph.width.map((width: number|string) {if (typeof width number) {return width px} else {return width}})} else if (typeof props.paragraph.width number) {return Array(paragraphRows.value).fill(props.paragraph.width px)} else {return Array(paragraphRows.value).fill(props.paragraph.width)}}
})
/script
templatedivv-ifloading:class[m-skeleton, {m-skeleton-avatar: avatar, m-skeleton-animated: animated}]:style--button-size: ${buttonSize}px; --title-top: ${titleTop}px;spanv-ifbutton:class[u-skeleton-button,{u-button-round: typeof button ! boolean button.shape round,u-button-circle: typeof button ! boolean button.shape circle,u-button-sm: typeof button ! boolean button.size small,u-button-lg: typeof button ! boolean button.size large,u-button-block: typeof button ! boolean button.shape ! circle button.block,}]/spanspan:class[u-skeleton-input,{u-input-sm: typeof input ! boolean input.size small,u-input-lg: typeof input ! boolean input.size large,}] v-ifinput/spandiv classm-skeleton-image v-ifimagesvg viewBox0 0 1098 1024 xmlnshttp://www.w3.org/2000/svg classm-skeleton-image-svgpath classu-skeleton-image-path dM365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z/path/svg/divdiv classm-skeleton-header v-ifavatarspan:class[u-skeleton-avatar,{u-avatar-sm: typeof avatar ! boolean avatar.size small,u-avatar-lg: typeof avatar ! boolean avatar.size large,u-avatar-square: typeof avatar ! boolean avatar.shape square,}]/span/divtemplate v-if!button !image !inputdiv classm-skeleton-contenth3 classu-skeleton-title :style{ width: titleWidth }/h3ul classu-skeleton-paragraphli v-forn in paragraphRows :keyn :stylewidth: ${paragraphWidth[(n as number) - 1]};/li/ul/div/template/divslot v-else/slot
/template
style langless scoped
.m-skeleton {display: table;width: 100%;.u-skeleton-button {display: inline-block;vertical-align: top;background: rgba(0, 0, 0, .06);border-radius: 4px;width: 64px;min-width: 64px;height: 32px;line-height: 32px;}.u-button-sm {width: 48px;min-width: 48px;height: 24px;line-height: 24px;}.u-button-lg {width: 80px;min-width: 80px;height: 40px;line-height: 40px;}.u-button-round {border-radius: var(--button-size);}.u-button-circle {width: var(--button-size);min-width: var(--button-size);border-radius: 50%;}.u-button-block {width: 100%;}.u-skeleton-input {display: inline-block;vertical-align: top;background: rgba(0, 0, 0, 0.06);border-radius: 4px;width: 160px;min-width: 160px;height: 32px;line-height: 32px;}.u-input-sm {width: 120px;min-width: 120px;height: 24px;line-height: 24px;}.u-input-lg {width: 200px;min-width: 200px;height: 40px;line-height: 40px;}.m-skeleton-image {display: flex;align-items: center;justify-content: center;vertical-align: top;background: rgba(0, 0, 0, .06);border-radius: 4px;width: 96px;height: 96px;line-height: 96px;.m-skeleton-image-svg {width: 48px;height: 48px;line-height: 48px;max-width: 192px;max-height: 192px;.u-skeleton-image-path {fill: #bfbfbf;}}}.m-skeleton-header {display: table-cell;padding-right: 16px;vertical-align: top;.u-skeleton-avatar {display: inline-block;vertical-align: top;background: rgba(0, 0, 0, .06);width: 32px;height: 32px;line-height: 32px;border-radius: 50%;}.u-avatar-sm {width: 24px;height: 24px;line-height: 24px;}.u-avatar-lg {width: 40px;height: 40px;line-height: 40px;}.u-avatar-square {border-radius: 6px;}}.m-skeleton-content {display: table-cell;width: 100%;vertical-align: top;.u-skeleton-title {margin: 0;height: 16px;background: rgba(0, 0, 0, .06);border-radius: 4px;}.u-skeleton-paragraph {margin-top: 24px;padding: 0;li {height: 16px;list-style: none;background: rgba(0, 0, 0, .06);border-radius: 4px;:not(:first-child) {margin-top: 16px;}:last-child {width: 61%;}}}}
}
.m-skeleton-avatar {.m-skeleton-content {.u-skeleton-title {margin-top: var(--title-top);}.u-skeleton-paragraph {margin-top: 28px;}}
}
.m-skeleton-animated {.u-skeleton-button,.u-skeleton-input,.m-skeleton-image,.m-skeleton-header .u-skeleton-avatar,.m-skeleton-content .u-skeleton-title,.m-skeleton-content .u-skeleton-paragraph li {position: relative;z-index: 0;overflow: hidden;background: transparent;::after {position: absolute;top: 0;left: -150%;bottom: 0;right: -150%;background: linear-gradient(90deg, rgba(0, 0, 0, .06) 25%, rgba(0, 0, 0, .15) 37%, rgba(0, 0, 0, .06) 63%);animation-name: skeleton-loading;animation-duration: 1.4s;animation-timing-function: ease;animation-iteration-count: infinite;content: ;}keyframes skeleton-loading {0% {transform: translateX(-37.5%);}100% {transform: translateX(37.5%);}}}
}
/style在要使用的页面引入
script setup langts
import Skeleton from ./Skeleton.vue
import { ref } from vueconst loading refboolean(false)const showSkeleton () {loading.value truesetTimeout(() {loading.value false}, 2000)
}
const animated ref(false)
const block ref(false)
const size ref(default)
const buttonShape ref(default)
const avatarShape ref(circle)
const sizeOptions ref([{label: Default,value: default},{label: Large,value: large},{label: Small,value: small}
])
const buttonShapeOptions ref([{label: Default,value: default},{label: Round,value: round},{label: Circle,value: circle}
])
const avatarShapeOptions ref([{label: Square,value: square},{label: Circle,value: circle}
])
/script
templatedivh1{{ $route.name }} {{ $route.meta.title }}/h1h2 classmt30 mb10基本使用/h2Skeleton /h2 classmt30 mb10复杂的组合/h2Skeleton avatar :paragraph{ rows: 4 } /h2 classmt30 mb10包含子组件/h2Button :loadingloading clickshowSkeletonShow Skeleton/Buttonbr/br/Skeleton :loadingloadingdivh4Vue Amazing UI, a design language/h4br/pWe supply a series of design principles, practical patterns and high quality designresources, to help people create their product prototypes beautifully and efficiently./p/div/Skeletonh2 classmt30 mb10自定义标题和段落/h2Skeleton avatar :title{ width: 24% } :paragraph{ rows: 4, width: [48%, 72%, 96%, 60%] } /h2 classmt30 mb10按钮 / 输入框 / 图像 / 头像/h2Flex :gap32Flex vertical :gap12 width50%Skeleton :animatedanimated :button{ shape: buttonShape, size: size, block: block} /Skeleton stylewidth: 200px :animatedanimated :input{ size: size } /Skeleton :animatedanimated image /Skeleton :avatar{ shape: avatarShape, size: size } :paragraph{ rows: 2 } //FlexFlex vertical :gap36 width50%Space :size32Space aligncenteranimated: Switch v-model:checkedanimated //SpaceSpace aligncenterButton Block: Switch v-model:checkedblock //Space/SpaceSpace aligncenterSize: Radio :optionssizeOptions v-model:valuesize //SpaceSpace aligncenterButton Shape: Radio :optionsbuttonShapeOptions v-model:valuebuttonShape //SpaceSpace aligncenterAvatar Shape: Radio :optionsavatarShapeOptions v-model:valueavatarShape //Space/Flex/Flex/div
/template
文章转载自: http://www.morning.rdzlh.cn.gov.cn.rdzlh.cn http://www.morning.tgczj.cn.gov.cn.tgczj.cn http://www.morning.pwppk.cn.gov.cn.pwppk.cn http://www.morning.tpdg.cn.gov.cn.tpdg.cn http://www.morning.smzr.cn.gov.cn.smzr.cn http://www.morning.fykqh.cn.gov.cn.fykqh.cn http://www.morning.fmkbk.cn.gov.cn.fmkbk.cn http://www.morning.xlmgq.cn.gov.cn.xlmgq.cn http://www.morning.nqmwk.cn.gov.cn.nqmwk.cn http://www.morning.qjngk.cn.gov.cn.qjngk.cn http://www.morning.ie-comm.com.gov.cn.ie-comm.com http://www.morning.wyfpc.cn.gov.cn.wyfpc.cn http://www.morning.cpnlq.cn.gov.cn.cpnlq.cn http://www.morning.dwzwm.cn.gov.cn.dwzwm.cn http://www.morning.xbptx.cn.gov.cn.xbptx.cn http://www.morning.gwqq.cn.gov.cn.gwqq.cn http://www.morning.qsctt.cn.gov.cn.qsctt.cn http://www.morning.lwcgh.cn.gov.cn.lwcgh.cn http://www.morning.dlrsjc.com.gov.cn.dlrsjc.com http://www.morning.dbxss.cn.gov.cn.dbxss.cn http://www.morning.dhyzr.cn.gov.cn.dhyzr.cn http://www.morning.dmtld.cn.gov.cn.dmtld.cn http://www.morning.mzwqt.cn.gov.cn.mzwqt.cn http://www.morning.wgbsm.cn.gov.cn.wgbsm.cn http://www.morning.byzpl.cn.gov.cn.byzpl.cn http://www.morning.pkggl.cn.gov.cn.pkggl.cn http://www.morning.gyzfp.cn.gov.cn.gyzfp.cn http://www.morning.nktgj.cn.gov.cn.nktgj.cn http://www.morning.lzttq.cn.gov.cn.lzttq.cn http://www.morning.bylzr.cn.gov.cn.bylzr.cn http://www.morning.dsncg.cn.gov.cn.dsncg.cn http://www.morning.whclz.cn.gov.cn.whclz.cn http://www.morning.uytae.cn.gov.cn.uytae.cn http://www.morning.xnfg.cn.gov.cn.xnfg.cn http://www.morning.dwwbt.cn.gov.cn.dwwbt.cn http://www.morning.hblkq.cn.gov.cn.hblkq.cn http://www.morning.nzfyx.cn.gov.cn.nzfyx.cn http://www.morning.srrrz.cn.gov.cn.srrrz.cn http://www.morning.kdlzz.cn.gov.cn.kdlzz.cn http://www.morning.wcjk.cn.gov.cn.wcjk.cn http://www.morning.rjnky.cn.gov.cn.rjnky.cn http://www.morning.ykklw.cn.gov.cn.ykklw.cn http://www.morning.gbxxh.cn.gov.cn.gbxxh.cn http://www.morning.qlrtd.cn.gov.cn.qlrtd.cn http://www.morning.zljqb.cn.gov.cn.zljqb.cn http://www.morning.hclplus.com.gov.cn.hclplus.com http://www.morning.mnslh.cn.gov.cn.mnslh.cn http://www.morning.ylpl.cn.gov.cn.ylpl.cn http://www.morning.xpmhs.cn.gov.cn.xpmhs.cn http://www.morning.fmrd.cn.gov.cn.fmrd.cn http://www.morning.tplht.cn.gov.cn.tplht.cn http://www.morning.rqfkh.cn.gov.cn.rqfkh.cn http://www.morning.mfmx.cn.gov.cn.mfmx.cn http://www.morning.knsmh.cn.gov.cn.knsmh.cn http://www.morning.phwmj.cn.gov.cn.phwmj.cn http://www.morning.jlthz.cn.gov.cn.jlthz.cn http://www.morning.qlckc.cn.gov.cn.qlckc.cn http://www.morning.kyctc.cn.gov.cn.kyctc.cn http://www.morning.jhyfb.cn.gov.cn.jhyfb.cn http://www.morning.jzykw.cn.gov.cn.jzykw.cn http://www.morning.qhtlq.cn.gov.cn.qhtlq.cn http://www.morning.jxdhc.cn.gov.cn.jxdhc.cn http://www.morning.phjny.cn.gov.cn.phjny.cn http://www.morning.wgdnd.cn.gov.cn.wgdnd.cn http://www.morning.lkrmp.cn.gov.cn.lkrmp.cn http://www.morning.dpsgq.cn.gov.cn.dpsgq.cn http://www.morning.qrhh.cn.gov.cn.qrhh.cn http://www.morning.wqfrd.cn.gov.cn.wqfrd.cn http://www.morning.dpgdj.cn.gov.cn.dpgdj.cn http://www.morning.lfcnj.cn.gov.cn.lfcnj.cn http://www.morning.lmmyl.cn.gov.cn.lmmyl.cn http://www.morning.rzdpd.cn.gov.cn.rzdpd.cn http://www.morning.yrdkl.cn.gov.cn.yrdkl.cn http://www.morning.jllnh.cn.gov.cn.jllnh.cn http://www.morning.nrzkg.cn.gov.cn.nrzkg.cn http://www.morning.htrzp.cn.gov.cn.htrzp.cn http://www.morning.kzhgy.cn.gov.cn.kzhgy.cn http://www.morning.wspjn.cn.gov.cn.wspjn.cn http://www.morning.qrgfw.cn.gov.cn.qrgfw.cn http://www.morning.rcww.cn.gov.cn.rcww.cn