uniapp 秋云ucharts 当前页面图表横屏全屏展示组件

再给组件传参时修改的参数  正常的ucharts所需参数需要修改  及要携带的 其他参数

//父组件
amplifyChartType.value = 'line' //图表类型
opts.value = JSON.parse(JSON.stringify(wOpts.value))//图表配置参数
amplifyChartData.value = JSON.parse(JSON.stringify(wChartData.value))//图表数据
opts.value.enableScroll = false//是否允许滑动
opts.value.rotate = true//横向展示
opts.value.dataLabel = false//图表中的默认数据
opts.value.legend.float = 'left'//修改图例位置
opts.value.legend.position = 'top'//修改图例位置
			
uni.hideTabBar() //隐藏底部栏
amplifyShow.value = true//控制图表是否显示
//组件
<template>
	<!-- 统计图横向全屏展示 -->
	<view v-if="show" @touchmove.stop.prevent="moveHandle" class="full_screen">
		<view class="full_screen_charts">
			<qiun-data-charts :type="type" :opts="opts" :ontouch="true" :chartData="chartData" />
			<view class="menu_box">
				<view>
					<image v-if="opts.dataLabel" @click="eyeShow(false)" class="eye_icon" src="https:/agent/icon/eye_icon.png" mode=""></image>
					<image v-else  @click="eyeShow(true)" class="eye_icon" src="https:/icon/eye_false_icon.png" mode=""></image>
				</view>
				<image class="reduce_icon" @click="cancel" src="https://agent/icon/reduce_icon.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script setup>
	// 当前组件主要作用于横向全屏展示
	// 传入前就修改传入给ucharts参数  在opts对象中
	// dataLabel: false,//图表中默认数据展示
	// dataPointShape: false,//图表默认数据下方小点
	// enableScroll: true,//是否允许滑动 不允许一屏展示全部
	// rotate:true,//横屏展示
	/**
	 * @show 控制组件是否显示
	 * @opts  ucharts 插件所需参数
	 * @chartData  ucharts 插件所需参数
	 * @type  图表所显示的图类型
	 * 
	 * @cancel  关闭组件
	 * 
	**/
	
	import { ref, defineProps, defineEmits } from 'vue'
	import {
		moveHandle
	} from '../../plugins/plugins.js'
	const props = defineProps(['show', 'opts', 'chartData', 'type'])
	const emit = defineEmits(['cancel'])
	
	const cancel = () =>{
		emit('cancel')
	}
	
	const eyeShow = (type) =>{
		props.opts.dataLabel = type
	}
	
	
</script>

<style scoped>
	.full_screen{
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		/* background-color: #fff; */
		background-color: rgba(0,0,0,.3);
		
	}
	
	.full_screen_charts{
		width: 100%;
		height:100%;
		background-color: #fff;
		/* transform: rotate(90deg); */
		box-sizing: border-box;
		padding: 30rpx;
	}
	
	.menu_box{
		position: absolute;
		right: 20rpx;
		bottom: 60rpx;
		transform: rotate(90deg);
		display: flex;
		align-items: center;
	}
	.rotate{
		transform: rotate(90deg);
	}
	
	.reduce_icon{
		width: 30rpx;
		height: 30rpx;
	}
	
	.eye_icon{
		width: 40rpx;
		height: 26rpx;
		margin-right: 20rpx;
	}
	
</style>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值