vue段落标题组件

1.BlockHeader.vue

<template>
  <div class="yh-block-header">
    <span class="yh-title">{{title}}</span>
    <slot></slot>
    <yh-button v-if="rightButton !== undefined" @click="$emit('rightButtonClicked')">{{rightButton}}</yh-button>
  </div>
</template>
<script>
import yhbutton from "./Button";
export default {
  name: "BlockHeader",
  data() {
    return {};
  },
  props: ["title", "rightButton"],
  methods: {},
  components: {
    "yh-button": yhbutton
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

2.BlockHeaderDemo.vue

<template>
  <div class="yh-page">
    <h1>BlockHeader演示</h1>
    <div class="yh-block">
      <yh-block-header title="模块一" rightButton="编辑" @rightButtonClicked="onEdit"></yh-block-header>
    </div>
    <div class="yh-block">
      <yh-block-header title="模块二">
        <yh-button @click="onInfo">详情</yh-button>
        <yh-button @click="onEdit">编辑</yh-button>
      </yh-block-header>
    </div>
  </div>
</template>
<script>
import yhblockheader from '../comcompont/BlockHeader'
import yhbutton from "../comcompont/Button";
export default {
  name: "BlockHeaderDemo",
  data() {
    return {};
  },
  methods: {
    onEdit() {},
    onInfo() {}
  },
  components: {
    "yh-button": yhbutton,
    "yh-block-header": yhblockheader
  }

};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scope>
</style>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值