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-row/u-row.vue | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 93 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-row/u-row.vue b/uni_modules/uview-ui/components/u-row/u-row.vue new file mode 100644 index 0000000..e608fc5 --- /dev/null +++ b/uni_modules/uview-ui/components/u-row/u-row.vue @@ -0,0 +1,93 @@ +<template> + <view + class="u-row" + ref="u-row" + :style="[rowStyle]" + @tap="clickHandler" + > + <slot /> + </view> +</template> + +<script> + // #ifdef APP-NVUE + const dom = uni.requireNativePlugin('dom') + // #endif + import props from './props.js'; + /** + * Row ��������������������� + * @description ��������������� 12 ������������������������������������ + * @tutorial https://www.uviewui.com/components/layout.html + * @property {String | Number} gutter ���������������������������������������������������px (������ 0 ) + * @property {String} justify ������������������(���������������������������) ������������`start`(���`flex-start`)���`end`(���`flex-end`)���`center`���`around`(���`space-around`)���`between`(���`space-between`) (������ 'start' ) + * @property {String} align ������������������ (������ 'center' ) + * @property {Object} customStyle ��������������������������������� + * + * @event {Function} click row��������� + * @example <u-row justify="space-between" customStyle="margin-bottom: 10px"></u-row> + */ + export default { + name: "u-row", + mixins: [uni.$u.mpMixin, uni.$u.mixin, props], + data() { + return { + + } + }, + computed: { + uJustify() { + if (this.justify == 'end' || this.justify == 'start') return 'flex-' + this.justify + else if (this.justify == 'around' || this.justify == 'between') return 'space-' + this.justify + else return this.justify + }, + uAlignItem() { + if (this.align == 'top') return 'flex-start' + if (this.align == 'bottom') return 'flex-end' + else return this.align + }, + rowStyle() { + const style = { + alignItems: this.uAlignItem, + justifyContent: this.uJustify + } + // ���������u-row������������������������������������u-col������gutter��������������������������������������������������������������������������������� + if(this.gutter) { + style.marginLeft = uni.$u.addUnit(-Number(this.gutter)/2) + style.marginRight = uni.$u.addUnit(-Number(this.gutter)/2) + } + return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)) + } + }, + methods: { + clickHandler(e) { + this.$emit('click') + }, + async getComponentWidth() { + // ������������������������������������������������ + await uni.$u.sleep() + return new Promise(resolve => { + // uView��������������������������������������������� + // #ifndef APP-NVUE + this.$uGetRect('.u-row').then(res => { + resolve(res.width) + }) + // #endif + // #ifdef APP-NVUE + // nvue���dom������������������������ + dom.getComponentRect(this.$refs['u-row'], (res) => { + resolve(res.size.width) + }) + // #endif + }) + }, + } + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + + .u-row { + @include flex; + } +</style> -- Gitblit v1.8.0