vue雪花飘落组件
发布于 2018-08-26 20:52:20
4930 次浏览
安装:
npm install --save vue-let-it-snow
复制代码在 index.js 中应用:
import Vue from 'vue'
import LetItSnow from 'vue-let-it-snow';
Vue.use(LetItSnow);
复制代码在某个你想有飘动的组件中,就可以直接用了
<template>
<let-it-snow
v-bind="snowConf"
:show="show"
></let-it-snow>
<template>
复制代码export default {
name: 'app',
data () {
return {
snowConf: {
windPower : 1,
speed : 3,
count : 12,
size : 10,
opacity : 1,
images: ['https://raw.githubusercontent.com/bob-chen/let_it_snow/master/demo/snow.png',
'https://raw.githubusercontent.com/bob-chen/let_it_snow/master/demo/sock.png',
'https://raw.githubusercontent.com/bob-chen/let_it_snow/master/demo/tree.png']
},
show: false
}
},
mounted () {
this.show = true
// setTimeout( () => {
// this.show = false
// }, 5000)
// setTimeout( () => {
// this.show = true
// }, 10000)
}
}
作者:Bob-Chen