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-collapse/u-collapse.vue | 90 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/components/u-collapse/u-collapse.vue b/uni_modules/uview-ui/components/u-collapse/u-collapse.vue
new file mode 100644
index 0000000..fc188a2
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-collapse/u-collapse.vue
@@ -0,0 +1,90 @@
+<template>
+ <view class="u-collapse">
+ <u-line v-if="border"></u-line>
+ <slot />
+ </view>
+</template>
+
+<script>
+ import props from './props.js';
+ /**
+ * collapse ������������
+ * @description ������������������������������������
+ * @tutorial https://www.uviewui.com/components/collapse.html
+ * @property {String | Number | Array} value ���������������������name������������������������[<string | number>]���������������������string | number
+ * @property {Boolean} accordion ������������������������ ������ false ���
+ * @property {Boolean} border ��������������������� ( ������ true ���
+ * @event {Function} change ���������������������������������(���������������������������������activeNames���������String������������Array)
+ * @example <u-collapse></u-collapse>
+ */
+ export default {
+ name: "u-collapse",
+ mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
+ watch: {
+ needInit() {
+ this.init()
+ }
+ },
+ created() {
+ this.children = []
+ },
+ computed: {
+ needInit() {
+ // ������computed���������������accordion���value������������
+ // ���������watch���������init()������������������������������������
+ return [this.accordion, this.value]
+ }
+ },
+ watch: {
+ // ���������������������������������������������������������������������������������������
+ parentData() {
+ if (this.children.length) {
+ this.children.map(child => {
+ // ���������������(u-checkbox)���������updateParentData���������������������������(������������������������������������������������������������������)
+ typeof(child.updateParentData) === 'function' && child.updateParentData()
+ })
+ }
+ },
+ },
+ methods: {
+ // ���������������������������������������������
+ init() {
+ this.children.map(child => {
+ child.init()
+ })
+ },
+ /**
+ * collapse-item������������������������collapse���������������������������������
+ * @param {Object} target ���������������������������
+ */
+ onChange(target) {
+ let changeArr = []
+ this.children.map((child, index) => {
+ // ������������������������������������������������������������
+ if (this.accordion) {
+ child.expanded = child === target ? !target.expanded : false
+ child.setContentAnimate()
+ } else {
+ if(child === target) {
+ child.expanded = !child.expanded
+ child.setContentAnimate()
+ }
+ }
+ // ������change���������������������������������
+ changeArr.push({
+ // ������������������name���������������������������������index������
+ name: child.name || index,
+ status: child.expanded ? 'open' : 'close'
+ })
+ })
+
+ this.$emit('change', changeArr)
+ this.$emit(target.expanded ? 'open' : 'close', target.name)
+ }
+ }
+ }
+</script>
+
+<style lang="scss" scoped>
+ @import "../../libs/css/components.scss";
+</style>
--
Gitblit v1.8.0