PopSelect.nvue 1.33 KB
<template>
	<uv-popup ref="popRef">
		<view class="pop_header">
      <view style="width: 22px;" style="visibility: hidden;"></view>
			<!-- <uv-icon name="close" size="22" class="pop_header_icon" ></uv-icon> -->
			<text class="pop_header_text">{{ titleWithDefault }}</text>
			<uv-icon name="close" size="22" class="pop_header_icon" @tap="handleCloseTypeSelect"></uv-icon>
		</view>
		<view class="l_type">
			<view class="l_type_item" v-for="(item,index) in xAxisFields" :key="item.key"
				:class="{'l_type_item_active':index === checkIndex}" @tap="handleChangeCheckType(index)">
				<text class="l_type_item_text" :class="{'l_type_item_active_text':index === checkIndex}">{{ item.name }}</text>
			</view>
		</view>
	</uv-popup>
</template>

<script setup>
  import {
    t
  } from '@/plugins/index.js'
  import {
    computed
  } from 'vue'
	const props = defineProps({
		title:{
			type: String,
			default: ''
		},
		options:{
			type: Array,
			default: () => []
		},
		direction: {
			type: String,
			default: 'bottom'
		}
	})
  const titleWithDefault = computed(() => {
    return props.title || t('app.title.kpiSelect')
  })
	
	


	// 打开弹窗
	const popRef = ref(null)
	const openPop = () => {
		popRef.value.open(props.direction)
	}

	defineOptions({
		openPop
	})
</script>

<style lang="scss">
	@import '@/styles/normal.scss';
</style>