在Vue.js应用程序中用于动画输入的简单而超小型的Vue.js组件。
# NPM
$ npm install vue-typical --save
1.安装并导入。
import typical from 'vue-typical'
2.在您的模板应用中:
<template>
<div id="app">
<typical
class="vt-title"
:steps="['Vue', 1000, 'Script', 500]"
:wrapper="'h2'"
></typical>
<typical
class="vt-subTitle"
:steps="['Vue', 1000, 'Script', 500, 'Vue365.cn :-) ', 1000]"
:loop="3"
:wrapper="'h3'"
></typical>
</div>
</template>
3.注册组件。
xport default {
name: 'app',
data: function() {
return {
msg: 'vue typical'
}
},
components: {
typical
}
}
4.选项。
steps: {
type: Array,
required: true
},
wrapper: {
type: String,
default: 'div'
},
loop: {
type: Number,
default: 1 // 或 'Infinity'
}