vue 小案例-02 大屏常用,点击目标,目标高亮,弹出弹层拿到点击目标数据

10 篇文章 0 订阅
<template>
  <div class="content tabs">
    <h1 class="title">考核评价</h1>
    <div
      v-for="(item, index) in userList"   //v-for 遍历数组数据
      :key="index"
      @click="changeClick(item)"
      :class="activeClick === item ? 'tab-container-active' : 'tab-container'"
    >
      <div class="tab-item">
        {{ item.name }}   //拿到每一项的name
      </div>
    </div>
    <el-dialog
      :title="`考核评价 - ${diaLogTitle}`"
      :visible="dialogVisible"
      @close="handleClose"
      width="30%"
    >
      <span>关于{{diaLogTitle}}的考核评价</span>
      <div>XXXXXXXXXXX</div>
      <div>XXXXXXXXXXX</div>    //内容一般来自于接口
    </el-dialog>
  </div>
</template>

<script>
export default {
  data () {
    return {
      userList: [    //数据一般对接接口
        {
          name: '疫情防控'
        },
        {
          name: '交通整治'
        },
        {
          name: '食品安全'
        },
        {
          name: '维稳安保'
        }
      ],
      dialogVisible: false,
      activeClick: '',
      diaLogTitle: ''
    }
  },
  methods: {
    // 点击传参
    changeClick (active) {
      // console.log(active)
      this.activeClick = active
      this.diaLogTitle = active.name
      this.dialogVisible = true
    },
    // 点击弹层X号,关闭弹层。
    handleClose () {
      this.dialogVisible = false
    }
  }
}
</script>
<style lang="less" scoped>
.content {
  width: 400px;
  height: 400px;
  background-color: rgb(203, 201, 218);
  color: aliceblue;
}
.tabs {
  display: flex;
  justify-content: space-between;
  margin: 35px 0 0 300px;
  flex-wrap: wrap;
}
.tab-item {
  background: rgba(105, 105, 105, 0.4);
  font-weight: 500;
  font-size: 32px;
  color: rgba(230, 242, 255, 0.7);
  letter-spacing: 1px;
  cursor: pointer;
  text-align: center;
  width: 360px;
  line-height: 32px;
  padding: 10px 0;
  box-sizing: border-box;
  margin: 10px;
}

.tab-container-active {
  .tab-item {
    background: rgba(0, 182, 243, 0.4);
    color: #ffffff;
    border: 3px solid #00b6f3;
    padding: 7px 0;
  }
}
</style>

视图:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值