<template>里面定义id,<script>里面要#id{ color: red} class 用点.

<template>里面定义id,<script>里面要#id{ color: red}

转载于:https://www.cnblogs.com/sulanlan/p/9923591.html

<template> <div class="Home"> <div class="index" id="mapTree"></div> <div class="top"> <div class="topLeft"> <div v-bind:class="{ redText: buttonStyle['Rail'], }" @click="toggleComponent('Rail')" > <a>电子围栏</a> </div> <div v-bind:class="{ redText: buttonStyle['Video'], }" @click="toggleComponent('Video')" > 视频监控 </div> <div v-bind:class="{ redText: buttonStyle['Location'], }" @click="toggleComponent('Location')" > 实时定位 </div> <div v-bind:class="{ redText: buttonStyle['Monitor'], }" @click="toggleComponent('Monitor')" > 环境检测 </div> </div> <div class="topRight"> <div>2</div> <div>2</div> <div>2</div> <div>2</div> </div> </div> <Rail v-if="currentComponent === 'Rail'" /> <Video v-if="currentComponent === 'Video'" /> <Location v-if="currentComponent === 'Location'" /> <Monitor v-if="currentComponent === 'Monitor'" /> </div> </template> <script> import Rail from "@/views/rail/rail.vue"; import Video from "@/views/video/video.vue"; import Location from "@/views/location/location.vue"; import Monitor from "@/views/monitor/monitor.vue"; let viewer; Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYzc0OGZjYi03NDY5LTRmMmQtYTc2YS05ZTY2YzZlMTRmYTQiLCJpZCI6MTM5MzQ0LCJpYXQiOjE2ODQzMTI2MjF9.nNF8IyvsjDSdeRJeea8ftf4TC1DOgSa_jue-ZZ0dZ8M"; export default { name: "MineHome", components: { Rail, Video, Location, Monitor, }, data() { return { currentComponent: "Rail", currentTab: "", // 记录当前选中的按钮 buttonStyle: { // 记录按钮样式 Rail: true, Video: false, Location: false, Monitor: false, }, }; }, mounted() { this.toggleComponent("Rail"); this.initMap(); }, methods: { // 初始化地图 initMap() { viewer = new Cesium.Viewer("mapTree", { infoBox: false, // 禁用infoBox }); // 加载倾斜模型 var tileset = new Cesium.Cesium3DTileset({ url: "http://47.104.159.54:8156/out2/tileset.json", }); viewer.scene.primitives.add(tileset); viewer.zoomTo(tileset); }, toggleComponent(componentName) { this.currentComponent = componentName; }, }, }; 根据这段代码实现 默认选中按钮字体颜色为红色 非选中为白色
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值