引入:
import header from './components/Header/index.js'
Vue.use(header)
使用:
<header-component></header-component>
配置:
<header-component
:title="title"
:border="border"
:instruction="instruction"
@method="getActive"
>
</header-component>
<script>
export default {
data() {
return {
title: '主页', // String header的标题 非必填
border: true, // Boolean header的底边框 非必填
instruction: '', // String header的功能显示 非必填
}
},
methods: {
// 当 instruction 显示时的回调函数
getActive() {
console.log('your code ...')
}
}
}
</script>
instruction介绍:
红色框为
instruction
的值,设置为其他值时将不显示。