frontend/examking-app/plugins/uview-ui/components/u-dropdown-item/u-dropdown-item.vue

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<template>
	<view class="u-dropdown-item" v-if="active" @touchmove.stop.prevent="() => {}" @tap.stop.prevent="() => {}">
		<block v-if="!$slots.default && !$slots.$default">
			<scroll-view scroll-y="true" :style="{
				height: $u.addUnit(height)
			}">
				<view class="u-dropdown-item__options">
					<u-cell-group>
						<u-cell-item @click="cellClick(item.value)" :arrow="false" :title="item.label" v-for="(item, index) in options"
						 :key="index" :title-style="{
							color: value == item.value ? activeColor : inactiveColor
						}">
							<u-icon v-if="value == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
						</u-cell-item>
					</u-cell-group>
				</view>
			</scroll-view>
		</block>
		<slot v-else />
	</view>
</template>

<script>
	/**
	 * dropdown-item 下拉菜单
	 * @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
	 * @tutorial http://uviewui.com/components/dropdown.html
	 * @property {String | Number} v-model 双向绑定选项卡选择值
	 * @property {String} title 菜单项标题
	 * @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
	 * @property {Boolean} disabled 是否禁用此选项卡(默认false)
	 * @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
	 * @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
	 * @example <u-dropdown-item title="标题"></u-dropdown-item>
	 */
	export default {
		name: 'u-dropdown-item',
		props: {
			// 当前选中项的value值
			value: {
				type: [Number, String, Array],
				default: ''
			},
			// 菜单项标题
			title: {
				type: [String, Number],
				default: ''
			},
			// 选项数据,如果传入了默认slot,此参数无效
			options: {
				type: Array,
				default () {
					return []
				}
			},
			// 是否禁用此菜单项
			disabled: {
				type: Boolean,
				default: false
			},
后面还有 72 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。