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-grid/u-grid.vue | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 97 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-grid/u-grid.vue b/uni_modules/uview-ui/components/u-grid/u-grid.vue new file mode 100644 index 0000000..b43cc27 --- /dev/null +++ b/uni_modules/uview-ui/components/u-grid/u-grid.vue @@ -0,0 +1,97 @@ +<template> + <view + class="u-grid" + ref='u-grid' + :style="[gridStyle]" + > + <slot /> + </view> +</template> + +<script> + import props from './props.js'; + /** + * grid ������������ + * @description ������������������������������������������������������������������������������������������������������������(badge)��������������������������������������������������������������������� + * @tutorial https://www.uviewui.com/components/grid.html + * @property {String | Number} col ������������������������ 3 ��� + * @property {Boolean} border ������������������������������������ false ��� + * @property {String} align ��������������������������������������������������������������������������������� ��������� 'left' ��� + * @property {Object} customStyle ��������������������������������� + * @event {Function} click ������������������ + * @example <u-grid :col="3" @click="click"></u-grid> + */ + export default { + name: 'u-grid', + mixins: [uni.$u.mpMixin, uni.$u.mixin,props], + data() { + return { + index: 0, + width: 0 + } + }, + watch: { + // ��������������������������������������������������������������������������������������� + parentData() { + if (this.children.length) { + this.children.map(child => { + // ���������������(u-radio)���������updateParentData���������������������������(������������������������������������������������������������������) + typeof(child.updateParentData) == 'function' && child.updateParentData(); + }) + } + }, + }, + created() { + // ���������children���������data������������������������������������������������������ + this.children = [] + }, + computed: { + // ��������������������������������������� + parentData() { + return [this.hoverClass, this.col, this.size, this.border]; + }, + // ������������������ + gridStyle() { + let style = {}; + switch (this.align) { + case 'left': + style.justifyContent = 'flex-start'; + break; + case 'center': + style.justifyContent = 'center'; + break; + case 'right': + style.justifyContent = 'flex-end'; + break; + default: + style.justifyContent = 'flex-start'; + }; + return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)); + } + }, + methods: { + // ������������u-grid-item������������������u-grid������������ + childClick(name) { + this.$emit('click', name) + } + } + }; +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + $u-grid-width:100% !default; + .u-grid { + /* #ifdef MP */ + width: $u-grid-width; + position: relative; + box-sizing: border-box; + overflow: hidden; + display: block; + /* #endif */ + justify-content: center; + @include flex; + flex-wrap: wrap; + align-items: center; + } +</style> -- Gitblit v1.8.0