frontend/examking-app/plugins/uview-ui/components/u-index-anchor/u-index-anchor.vue

(开头部分) 2KB

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

<template>
	<!-- 支付宝小程序使用$u.getRect()获取组件的根元素尺寸,所以在外面套一个"壳" -->
	<view>
		<view class="u-index-anchor-wrapper" :id="$u.guid()" :style="[wrapperStyle]">
			<view class="u-index-anchor " :class="[active ? 'u-index-anchor--active' : '']" :style="[customAnchorStyle]">
				<slot v-if="useSlot" />
				<block v-else>
					<text>{{ index }}</text>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	/**
	 * indexAnchor 索引列表锚点
	 * @description 通过折叠面板收纳内容区域,搭配<u-index-anchor>使用
	 * @tutorial https://www.uviewui.com/components/indexList.html#indexanchor-props
	 * @property {Boolean} use-slot 是否使用自定义内容的插槽(默认false)
	 * @property {String Number} index 索引字符,如果定义了use-slot,此参数自动失效
	 * @property {Object} custStyle 自定义样式,对象形式,如"{color: 'red'}"
	 * @event {Function} default 锚点位置显示内容,默认为索引字符
	 * @example <u-index-anchor :index="item" />
	 */
	export default {
		name: "u-index-anchor",
		props: {
			useSlot: {
				type: Boolean,
				default: false
			},
			index: {
				type: String,
				default: ''
			},
			customStyle: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		data() {
			return {
				active: false,
				wrapperStyle: {},
				anchorStyle: {}
			}
		},
		created() {
			this.parent = false;
		},
		mounted() {
			this.parent = this.$u.$parent.call(this, 'u-index-list');
			if(this.parent) {
				this.parent.children.push(this);
				this.parent.updateData();
			}
		},
后面还有 29 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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