From e13367edf304cb78f978e321f1679299a66b3a23 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 10 Jan 2024 16:08:18 +0800
Subject: [PATCH] fix:地图
---
uni_modules/uview-ui/components/u-back-top/u-back-top.vue | 129 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 129 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/components/u-back-top/u-back-top.vue b/uni_modules/uview-ui/components/u-back-top/u-back-top.vue
new file mode 100644
index 0000000..2d07566
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-back-top/u-back-top.vue
@@ -0,0 +1,129 @@
+<template>
+ <u-transition
+ mode="fade"
+ :customStyle="backTopStyle"
+ :show="show"
+ >
+ <view
+ class="u-back-top"
+ :style="[contentStyle]"
+ v-if="!$slots.default && !$slots.$default"
+ @click="backToTop"
+ >
+ <u-icon
+ :name="icon"
+ :custom-style="iconStyle"
+ ></u-icon>
+ <text
+ v-if="text"
+ class="u-back-top__text"
+ >{{text}}</text>
+ </view>
+ <slot v-else />
+ </u-transition>
+</template>
+
+<script>
+ import props from './props.js';
+ // #ifdef APP-NVUE
+ const dom = weex.requireModule('dom')
+ // #endif
+ /**
+ * backTop ������������
+ * @description ������������������������������������������������������������������������������������������������������������������������
+ * @tutorial https://uviewui.com/components/backTop.html
+ *
+ * @property {String} mode ������������������������circle-���������square-������ ��������� 'circle' ���
+ * @property {String} icon ��������������� ��������� 'arrow-upward' ��� ���������������������
+ * @property {String} text ������������
+ * @property {String | Number} duration ������������������������ ��������� 100���
+ * @property {String | Number} scrollTop ������������ ��������� 0 ���
+ * @property {String | Number} top ���������������������������������������px ��������� 400 ���
+ * @property {String | Number} bottom ���������������������������������������������px ��������� 100 ���
+ * @property {String | Number} right ���������������������������������������������px ��������� 20 ���
+ * @property {String | Number} zIndex ������ ��������� 9 ���
+ * @property {Object<Object>} iconStyle ������������������������������ ��������� {color: '#909399',fontSize: '19px'}���
+ * @property {Object} customStyle ���������������������������������
+ *
+ * @example <u-back-top :scrollTop="scrollTop"></u-back-top>
+ */
+ export default {
+ name: 'u-back-top',
+ mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
+ computed: {
+ backTopStyle() {
+ // ������������������
+ const style = {
+ bottom: uni.$u.addUnit(this.bottom),
+ right: uni.$u.addUnit(this.right),
+ width: '40px',
+ height: '40px',
+ position: 'fixed',
+ zIndex: 10,
+ }
+ return style
+ },
+ show() {
+ return uni.$u.getPx(this.scrollTop) > uni.$u.getPx(this.top)
+ },
+ contentStyle() {
+ const style = {}
+ let radius = 0
+ // ������������
+ if(this.mode === 'circle') {
+ radius = '100px'
+ } else {
+ radius = '4px'
+ }
+ // ������������������nvue������������������������
+ style.borderTopLeftRadius = radius
+ style.borderTopRightRadius = radius
+ style.borderBottomLeftRadius = radius
+ style.borderBottomRightRadius = radius
+ return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+ }
+ },
+ methods: {
+ backToTop() {
+ // #ifdef APP-NVUE
+ if (!this.$parent.$refs['u-back-top']) {
+ uni.$u.error(`nvue������������������������������������������"ref='u-back-top'`)
+ }
+ dom.scrollToElement(this.$parent.$refs['u-back-top'], {
+ offset: 0
+ })
+ // #endif
+
+ // #ifndef APP-NVUE
+ uni.pageScrollTo({
+ scrollTop: 0,
+ duration: this.duration
+ });
+ // #endif
+ this.$emit('click')
+ }
+ }
+ }
+</script>
+
+<style lang="scss" scoped>
+ @import '../../libs/css/components.scss';
+ $u-back-top-flex:1 !default;
+ $u-back-top-height:100% !default;
+ $u-back-top-background-color:#E1E1E1 !default;
+ $u-back-top-tips-font-size:12px !default;
+ .u-back-top {
+ @include flex;
+ flex-direction: column;
+ align-items: center;
+ flex:$u-back-top-flex;
+ height: $u-back-top-height;
+ justify-content: center;
+ background-color: $u-back-top-background-color;
+
+ &__tips {
+ font-size:$u-back-top-tips-font-size;
+ transform: scale(0.8);
+ }
+ }
+</style>
--
Gitblit v1.8.0