赞
踩
npm install vue-light-timeline --save
import LightTimeline from 'vue-light-timeline';
Vue.use(LightTimeline)
<template>
<light-timeline :items='items'></light-timeline>
</template>
<script>
const theme = 'red';
export default {
data () {
return {
items: [
{
tag: '2018-01-12',
content: 'hallo'
},
{
tag: '2018-01-13',
color: '#dcdcdc',
type: 'circle',
content: 'world'
},
{
type: 'star',
tag: '2018-01-14',
htmlMode: true,
content: `<div style="color: ${theme};"> =v = </div>`
}
]
}
}
}
</script>
<style scoped lang="stylus">
</style>
或者使用slot插槽
<template>
<light-timeline :items='items'>
<template slot='tag' slot-scope='{ item }'>
{{item.date}}
</template>
<template slot='symbol' slot-scope='{ item }'>
<div class="my_icon_class"><i :class="item.class"></i><div>
</template>
<template slot='content' slot-scope='{ item }'>
{{item.content}}
</template>
</light-timeline>
</template>
<script>
export default {
data () {
return {
items: [
{
tag: '2018-01-12',
content: 'hallo',
class: 'fas fa-star'
},
{
tag: '2018-01-13',
content: 'world',
class: 'far fa-star'
},
{
tag: '2018-01-14',
content: 'other',
class: 'fas fa-star'
}
]
}
}
}
</script>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。