53 lines
857 B
Vue
53 lines
857 B
Vue
<script>
|
|
export default {
|
|
name: 'MenuItem',
|
|
functional: true,
|
|
props: {
|
|
icon: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
rotate: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
render(h, context) {
|
|
const { icon, title } = context.props
|
|
const vnodes = []
|
|
|
|
if (icon) {
|
|
if (context.props.rotate) {
|
|
vnodes.push(<svg-icon icon-class={icon} class="rotate"/>)
|
|
} else {
|
|
vnodes.push(<svg-icon icon-class={icon}/>)
|
|
}
|
|
}
|
|
|
|
if (title) {
|
|
vnodes.push(<span slot='title'>{(title)}</span>)
|
|
}
|
|
return vnodes
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.rotate {
|
|
animation: rotate 2s linear infinite;
|
|
color: #409eff;
|
|
}
|
|
|
|
@keyframes rotate {
|
|
from {
|
|
transform: rotate(0deg);
|
|
}
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
</style>
|