1.1.6 • Published 5 years ago
vue-colorful-background v1.1.6
vue-colorful-background
Make a colorful background with vue directive
Install
npm install vue-colorful-background
Usage
// es6 import
import VueColorfulBackground from 'vue-colorful-background'
// 或者通过<script>引入
<script src="path/to/vue-colorful-background.js"></script>
// main.js
Vue.use(VueColorfulBackground)
<div v-colorful="options"></div>
<script>
// ...
data () {
return {
options: {
}
}
}
</script>
Options
Name | Type | Default | Description |
---|---|---|---|
duration | String | 2s | 背景色过渡的耗时,其值与css 属性transition-duration 一致 |
timing | String | ease-in | 背景色渐变速度曲线,其值与css 属性transition-timing-function 一致 |
colors | Array | [...] | 背景色,默认提供250 种颜色,颜色引用自http://nipponcolors.com/ |
delay | Number | 2000 | 背景色切换间隔 |
Modifiers
v-colorful
默认按照colors
数组中的顺序切换背景色,使用.random
修饰符可以使背景色随机切换
<div v-colorful.random></div>