国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

vue-cli 構建骨架屏的方法示例

2024-05-06 15:28:06
字體:
來源:轉載
供稿:網友

腳手架不說了,提前搭建好

然后安裝 vue-skeleton-webpack-plugin

npm install vue-skeleton-webpack-plugin 

創建文件 skeleton.js和skeleton.vue

skeleton.js

import Vue from 'vue'import Skeleton from './Skeleton.vue'export default new Vue({components: {Skeleton},template: '<skeleton />'})

skeleton.vue

我的skeleton.vue不知為何<style>標簽寫在外部沒有加載進去,故寫到<template>內

樣式和模板可以自己修改

<template><div class="skeleton-wrapper"><style>.skeleton {padding: 10px;}.skeleton .skeleton-head,.skeleton .skeleton-title,.skeleton .skeleton-content-bottom,.skeleton .skeleton-content {background: rgba(194, 207, 214,.5);background-image: linear-gradient(90deg,rgba(255, 255, 255, 0.15) 25%, transparent 25%);background-size: 20rem 20rem;animation: skeleton-stripes 1s linear infinite;margin: 0 auto 30px;text-align: center;color: darkgray;}.skeleton-head {width: 100px;height: 60px;float: left;}.skeleton-body {margin-left: 110px;}.skeleton-title {width: 90%;height: 60px;line-height: 60px;}.skeleton-content {width: 60%;height: 40px;background: rgba(194, 207, 214,.3)!important;}.skeleton-content-bottom {width: 40%;height: 40px;margin: 0 auto 30px 20%!important;background: rgba(194, 207, 214,.3)!important;}@keyframes skeleton-stripes {from {background-position: 0 0 ;}to {background-position: 20rem 0;}}</style><header class="skeleton-header"></header><section class="skeleton-block"><div class="skeleton"><div class="skeleton-head"></div><div class="skeleton-body"><div class="skeleton-title">加載中</div><div class="skeleton-content"></div><div class="skeleton-content-bottom"></div><div class="skeleton-content"></div><div class="skeleton-content-bottom"></div><div class="skeleton-content"></div><div class="skeleton-content-bottom"></div><div class="skeleton-content"></div><div class="skeleton-content-bottom"></div><div class="skeleton-content"></div></div></div></section></div></template><script>export default {name: 'skeleton'}</script>

在build 目錄下創建 webpack.skeleton.conf.js

'use strict';const path = require('path')const merge = require('webpack-merge')const baseWebpackConfig = require('./webpack.base.conf')const nodeExternals = require('webpack-node-externals')function resolve(dir) {return path.join(__dirname, dir)}module.exports = merge(baseWebpackConfig, {target: 'node',devtool: false,entry: {//指向自己的skeleton.js路徑app: resolve('../src/renderer/skeleton/skeleton.js')},output: Object.assign({}, baseWebpackConfig.output, {libraryTarget: 'commonjs2'}),externals: nodeExternals({whitelist: //.css$/}),plugins: []})            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 尚志市| 荆门市| 临邑县| 张北县| 孝义市| 甘孜县| 太原市| 普定县| 临泽县| 彭泽县| 开封市| 合肥市| 桃园市| 新源县| 青龙| 廉江市| 蕉岭县| 锡林郭勒盟| 桦南县| 顺平县| 英山县| 宁晋县| 克山县| 呼伦贝尔市| 垫江县| 德钦县| 汉阴县| 拉孜县| 闽侯县| 乌拉特前旗| 香河县| 五华县| 宁化县| 浪卡子县| 阿拉善右旗| 略阳县| 玉龙| 五峰| 兴隆县| 库伦旗| 淅川县|