vue element 下拉组件菜单

<template>

  <div class="device-detail">

    <el-menu @select="selectMenu" :router="false" :default-active="activeName" class="device-detail-nav" mode="horizontal" background-color="#fff" text-color="#333" active-text-color="#409eff">

      <el-menu-item index="Info">{{ $t('menu.personal_information') }}</el-menu-item>

      <el-menu-item index="Attention">{{ $t('menu.my_attention') }}</el-menu-item>

      <el-menu-item index="Message">{{ $t('menu.my_message') }}</el-menu-item>

    </el-menu>

    <!--<router-view></router-view>-->

    <component :is="currentComponent"></component>

  </div>

</template>

<script>

import { getDeviceCameraStatus } from '@/api/devices'

export default {

  name: "jobDetails",

  components: {

    DeviceInfo: () => import('@/views/informationService/jobCommon/personalInformation'),

    DeviceAttention: () => import('@/views/informationService/jobCommon/myAttention'),

    DeviceMessage: () => import('@/views/informationService/jobCommon/myMessage'),

  },

  data() {

    return {

      showCamera: false,

      activeName: 'Info',

      typeId: this.$route.params.typeid,

      deviceId: this.$route.params.id,

      currentComponent: '',

    }

  },

  mounted() {

    this.currentComponent = () => import('./jobCommon/personalInformation')

    // this.getCameraStatus()

  },

  computed: {

    /*navUrl() {

      return `/devices/detail/${this.deviceId}/type/${this.typeId}/`;

    },

    activeNav() {

      const route = this.$route;

      const {path} = route;

      const subPath = path.split('/');

      //console.log(subPath)

      return path

    }*/

  },

  methods: {

    selectMenu(index) {

      this.currentComponent = 'Device' + index

    },

    //增加一个查询设备是否有视频设备

    // getCameraStatus() {

    //   getDeviceCameraStatus({

    //     user_id: this.$store.getters.userid,

    //     device_id: this.deviceId,

    //   }).then((res) => {

    //     if (res.data.errcode === 0) {

    //       this.showCamera = res.data.data.show_video

    //     }

    //   })

    // },

  },

}

</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
element下拉菜单是通过使用element-ui组件库中的el-dropdown、el-dropdown-menuel-dropdown-item组件来实现的。\[1\]在使用element-ui之前,需要先安装element-ui组件库,可以通过执行命令npm i element-ui来进行安装。\[2\]安装完成后,在项目的main.js文件中进行配置。可以选择两种方式引入element-ui组件:一种是引入所有的element-ui组件,另一种是按需引入需要的组件。\[2\]在Vue页面中实现下拉菜单时,可以使用el-dropdown作为容器,el-dropdown-menu作为下拉列表,el-dropdown-item作为下拉菜单项。具体的使用方法可以参考element-ui的官方文档。 #### 引用[.reference_title] - *1* [element-ui_dropdown-下拉菜单](https://blog.csdn.net/gaogzhen/article/details/107947046)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [element-ui中el-selectel-tree的结合使用实现下拉菜单](https://blog.csdn.net/carefree31441/article/details/121918787)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值