最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2018年11月08日 14:54:24   作者:web窩  
這篇文章主要介紹了vue-cli 構建骨架屏的方法示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

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

然后安裝 vue-skeleton-webpack-plugin

npm install vue-skeleton-webpack-plugin 

創(chuàng)建文件 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 目錄下創(chuàng)建 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: []
})

大功告成

vue-skeleton-webpack-plugin 可以 使用多個 骨架屏 ,具體的可以查看官網地址: https://github.com/lavas-project/vue-skeleton-webpack-plugin

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論

汾西县| 绿春县| 文登市| 双桥区| 广河县| 正镶白旗| 黄山市| 高唐县| 莱州市| 宜城市| 兴业县| 东台市| 盐城市| 丰台区| 朝阳区| 青川县| 公安县| 烟台市| 广德县| 新疆| 沛县| 澎湖县| 榕江县| 江津市| 四平市| 湾仔区| 田阳县| 土默特左旗| 佛坪县| 江西省| 军事| 罗源县| 天镇县| 怀集县| 抚顺县| 师宗县| 温州市| 荔浦县| 普兰县| 东海县| 武城县|