From 1e61215b48e59e94c1ed98e4ef956227d689d6bc Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 06 Nov 2023 08:48:39 +0800
Subject: [PATCH] fix:小程序订阅消息
---
uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue | 127 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 127 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue b/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue
new file mode 100644
index 0000000..f830291
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue
@@ -0,0 +1,127 @@
+<template>
+ <view class="u-drawdown">
+ <view
+ class="u-dropdown__menu"
+ :style="{
+ height: $u.addUnit(height)
+ }"
+ ref="u-dropdown__menu"
+ >
+ <view
+ class="u-dropdown__menu__item"
+ v-for="(item, index) in menuList"
+ :key="index"
+ @tap.stop="clickHandler(item, index)"
+ >
+ <view class="u-dropdown__menu__item__content">
+ <text
+ class="u-dropdown__menu__item__content__text"
+ :style="[index === current ? activeStyle : inactiveStyle]"
+ >{{item.title}}</text>
+ <view
+ class="u-dropdown__menu__item__content__arrow"
+ :class="[index === current && 'u-dropdown__menu__item__content__arrow--rotate']"
+ >
+ <u-icon
+ :name="menuIcon"
+ :size="$u.addUnit(menuIconSize)"
+ ></u-icon>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view class="u-dropdown__content">
+ <slot />
+ </view>
+ </view>
+</template>
+
+<script>
+import props from './props.js';
+/**
+ * Dropdown
+ * @description
+ * @tutorial url
+ * @property {String}
+ * @event {Function}
+ * @example
+ */
+export default {
+ name: 'u-dropdown',
+ mixins: [uni.$u.mixin, props],
+ data() {
+ return {
+ // ��������������������
+ menuList: [],
+ current: 0
+ }
+ },
+ computed: {
+
+ },
+ created() {
+ // ���������������������������������������(u-dropdown-item)������this������������������������data��������������������������������������������������������������������������������������������������������������������������
+ this.children = [];
+ },
+ methods: {
+ clickHandler(item, index) {
+ this.children.map(child => {
+ if(child.title === item.title) {
+ // this.queryRect('u-dropdown__menu').then(size => {
+ child.$emit('click')
+ child.setContentAnimate(child.show ? 0 : 300)
+ child.show = !child.show
+ // })
+ } else {
+ child.show = false
+ child.setContentAnimate(0)
+ }
+ })
+ },
+ // ����������������������������������
+ queryRect(el) {
+ // #ifndef APP-NVUE
+ // $uGetRect��uView����������������������������������������������������������������������������https://www.uviewui.com/js/getRect.html
+ // �������������������������������this.$uGetRect�����������������������this.$u.getRect����������������������������������������������������
+ return new Promise(resolve => {
+ this.$uGetRect(`.${el}`).then(size => {
+ resolve(size)
+ })
+ })
+ // #endif
+
+ // #ifdef APP-NVUE
+ // nvue����������������dom�������������������������
+ // ��������������������promise��������������������������������������������������������������then��������
+ return new Promise(resolve => {
+ dom.getComponentRect(this.$refs[el], res => {
+ resolve(res.size)
+ })
+ })
+ // #endif
+ },
+ },
+}
+</script>
+
+<style lang="scss">
+@import '../../libs/css/components.scss';
+
+.u-dropdown {
+
+ &__menu {
+ @include flex;
+
+ &__item {
+ flex: 1;
+ @include flex;
+ justify-content: center;
+
+ &__content {
+ @include flex;
+ align-items: center;
+ }
+ }
+ }
+}
+</style>
--
Gitblit v1.8.0