第一步:小程序中实现骨架屏在微信开发者工具中点击生成骨架屏:

第二步:复制html代码,到骨架屏vue组件汇中再把之前写的样式代码引入进去:

@import '../../pages/user/user.css';

第三步:组件中引入骨架屏:

import lodingHtml from '@/skeleton/cardOther/cardOther';

第四步:定义骨架屏变量:

lodingShow: true,

第五步:使用映入的骨架屏:

<loding-html v-if="lodingShow"></loding-html>
<view v-else></view>

第六步:数据请求成功之后,骨架屏关闭

this.lodingShow = false;

更多推荐