code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
<template> <!-- #ifdef APP-NVUE --> <cell :keep-scroll-position="keepScrollPosition"> <!-- #endif --> <view :class="{ 'uni-list-item--disabled': disabled }" :style="{'background-color':customStyle.backgroundColor}" :hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'" class="uni-list-item" @click="onClick"> <view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view> <view class="uni-list-item__container" :class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column'}" :style="{paddingTop:padding.top,paddingLeft:padding.left,paddingRight:padding.right,paddingBottom:padding.bottom}"> <slot name="header"> <view class="uni-list-item__header"> <view v-if="thumb" class="uni-list-item__icon"> <image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" /> </view> <view v-else-if="showExtraIcon" class="uni-list-item__icon"> <uni-icons :customPrefix="extraIcon.customPrefix" :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" /> </view> </view> </slot> <slot name="body"> <view class="uni-list-item__content" :class="{ 'uni-list-item__content--center': thumb || showExtraIcon || showBadge || showSwitch }"> <text v-if="title" class="uni-list-item__content-title" :class="[ellipsis !== 0 && ellipsis <= 2 ? 'uni-ellipsis-' + ellipsis : '']">{{ title }}</text> <text v-if="note" class="uni-list-item__content-note">{{ note }}</text> </view> </slot> <slot name="footer"> <view v-if="rightText || showBadge || showSwitch" class="uni-list-item__extra" :class="{ 'flex--justify': direction === 'column' }"> <text v-if="rightText" class="uni-list-item__extra-text">{{ rightText }}</text> <uni-badge v-if="showBadge" :type="badgeType" :text="badgeText" :custom-style="badgeStyle" /> <switch v-if="showSwitch" :disabled="disabled" :checked="switchChecked" @change="onSwitchChange" /> </view> </slot> </view> <uni-icons v-if="showArrow || link" :size="16" class="uni-icon-wrapper" color="#bbb" type="arrowright" /> </view> <!-- #ifdef APP-NVUE --> </cell> <!-- #endif --> </template> <script> /** * ListItem 列表子组件 * @description 列表子组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=24 * @property {String} title 标题 * @property {String} note 描述 * @property {String} thumb 左侧缩略图,若thumb有值,则不会显示扩展图标 * @property {String} thumbSize = [lg|base|sm] 略缩图大小 * @value lg 大图 * @value base 一般 * @value sm 小图 * @property {String} badgeText 数字角标内容 * @property {String} badgeType 数字角标类型,参考[uni-icons](https://ext.dcloud.net.cn/plugin?id=21) * @property {Object} badgeStyle 数字角标样式 * @property {String} rightText 右侧文字内容 * @property {Boolean} disabled = [true|false] 是否禁用 * @property {Boolean} clickable = [true|false] 是否开启点击反馈 * @property {String} link = [navigateTo|redirectTo|reLaunch|switchTab] 是否展示右侧箭头并开启点击反馈 * @value navigateTo 同 uni.navigateTo() * @value redirectTo 同 uni.redirectTo() * @value reLaunch 同 uni.reLaunch() * @value switchTab 同 uni.switchTab() * @property {String | PageURIString} to 跳转目标页面 * @property {Boolean} showBadge = [true|false] 是否显示数字角标 * @property {Boolean} showSwitch = [true|false] 是否显示Switch * @property {Boolean} switchChecked = [true|false] Switch是否被选中 * @property {Boolean} showExtraIcon = [true|false] 左侧是否显示扩展图标 * @property {Object} extraIcon 扩展图标参数,格式为 {color: '#4cd964',size: '22',type: 'spinner'} * @property {String} direction = [row|column] 排版方向 * @value row 水平排列 * @value column 垂直排列 * @event {Function} click 点击 uniListItem 触发事件 * @event {Function} switchChange 点击切换 Switch 时触发 */ export default { name: 'UniListItem', emits: ['click', 'switchChange'], props: { direction: { type: String, default: 'row' }, title: { type: String, default: '' }, note: { type: String, default: '' }, ellipsis: { type: [Number, String], default: 0 }, disabled: { type: [Boolean, String], default: false }, clickable: { type: Boolean, default: false }, showArrow: { type: [Boolean, String], default: false }, link: { type: [Boolean, String], default: false }, to: { type: String, default: '' }, showBadge: { type: [Boolean, String], default: false }, showSwitch: { type: [Boolean, String], default: false }, switchChecked: { type: [Boolean, String], default: false }, badgeText: { type: String, default: '' }, badgeType: { type: String, default: 'success' }, badgeStyle: { type: Object, default () { return {} } }, rightText: { type: String, default: '' }, thumb: { type: String, default: '' }, thumbSize: { type: String, default: 'base' }, showExtraIcon: { type: [Boolean, String], default: false }, extraIcon: { type: Object, default () { return { type: '', color: '#000000', size: 20, customPrefix: '' }; } }, border: { type: Boolean, default: true }, customStyle: { type: Object, default () { return { padding: '', backgroundColor: '#FFFFFF' } } }, keepScrollPosition: { type: Boolean, default: false } }, watch: { 'customStyle.padding': { handler(padding) { if(typeof padding == 'number'){ padding += '' } let paddingArr = padding.split(' ') if (paddingArr.length === 1) { const allPadding = paddingArr[0] this.padding = { "top": allPadding, "right": allPadding, "bottom": allPadding, "left": allPadding } } else if (paddingArr.length === 2) { const [verticalPadding, horizontalPadding] = paddingArr; this.padding = { "top": verticalPadding, "right": horizontalPadding, "bottom": verticalPadding, "left": horizontalPadding } } else if (paddingArr.length === 4) { const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr; this.padding = { "top": topPadding, "right": rightPadding, "bottom": bottomPadding, "left": leftPadding } } }, immediate: true } }, // inject: ['list'], data() { return { isFirstChild: false, padding: { top: "", right: "", bottom: "", left: "" } }; }, mounted() { this.list = this.getForm() // 判断是否存在 uni-list 组件 if (this.list) { if (!this.list.firstChildAppend) { this.list.firstChildAppend = true; this.isFirstChild = true; } } }, methods: { /** * 获取父元素实例 */ getForm(name = 'uniList') { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false parentName = parent.$options.name; } return parent; }, onClick() { if (this.to !== '') { this.openPage(); return; } if (this.clickable || this.link) { this.$emit('click', { data: {} }); } }, onSwitchChange(e) { this.$emit('switchChange', e.detail); }, openPage() { if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'].indexOf(this.link) !== -1) { this.pageApi(this.link); } else { this.pageApi('navigateTo'); } }, pageApi(api) { let callback = { url: this.to, success: res => { this.$emit('click', { data: res }); }, fail: err => { this.$emit('click', { data: err }); } } switch (api) { case 'navigateTo': uni.navigateTo(callback) break case 'redirectTo': uni.redirectTo(callback) break case 'reLaunch': uni.reLaunch(callback) break case 'switchTab': uni.switchTab(callback) break default: uni.navigateTo(callback) } } } }; </script> <style lang="scss"> $uni-font-size-sm:12px; $uni-font-size-base:14px; $uni-font-size-lg:16px; $uni-spacing-col-lg: 12px; $uni-spacing-row-lg: 15px; $uni-img-size-sm:20px; $uni-img-size-base:26px; $uni-img-size-lg:40px; $uni-border-color:#e5e5e5; $uni-bg-color-hover:#f1f1f1; $uni-text-color-grey:#999; $list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg; .uni-list-item { /* #ifndef APP-NVUE */ display: flex; /* #endif */ font-size: $uni-font-size-lg; position: relative; justify-content: space-between; align-items: center; background-color: #fff; flex-direction: row; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-list-item--disabled { opacity: 0.3; } .uni-list-item--hover { background-color: $uni-bg-color-hover; } .uni-list-item__container { position: relative; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; padding: $list-item-pd; padding-left: $uni-spacing-row-lg; flex: 1; overflow: hidden; // align-items: center; } .container--right { padding-right: 0; } // .border--left { // margin-left: $uni-spacing-row-lg; // } .uni-list--border { position: absolute; top: 0; right: 0; left: 0; /* #ifdef APP-NVUE */ border-top-color: $uni-border-color; border-top-style: solid; border-top-width: 0.5px; /* #endif */ } /* #ifndef APP-NVUE */ .uni-list--border:after { position: absolute; top: 0; right: 0; left: 0; height: 1px; content: ''; -webkit-transform: scaleY(0.5); transform: scaleY(0.5); background-color: $uni-border-color; } /* #endif */ .uni-list-item__content { /* #ifndef APP-NVUE */ display: flex; /* #endif */ padding-right: 8px; flex: 1; color: #3b4144; // overflow: hidden; flex-direction: column; justify-content: space-between; overflow: hidden; } .uni-list-item__content--center { justify-content: center; } .uni-list-item__content-title { font-size: $uni-font-size-base; color: #3b4144; overflow: hidden; } .uni-list-item__content-note { margin-top: 6rpx; color: $uni-text-color-grey; font-size: $uni-font-size-sm; overflow: hidden; } .uni-list-item__extra { // width: 25%; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: flex-end; align-items: center; } .uni-list-item__header { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: center; } .uni-list-item__icon { margin-right: 18rpx; flex-direction: row; justify-content: center; align-items: center; } .uni-list-item__icon-img { /* #ifndef APP-NVUE */ display: block; /* #endif */ height: $uni-img-size-base; width: $uni-img-size-base; margin-right: 10px; } .uni-icon-wrapper { /* #ifndef APP-NVUE */ display: flex; /* #endif */ align-items: center; padding: 0 10px; } .flex--direction { flex-direction: column; /* #ifndef APP-NVUE */ align-items: initial; /* #endif */ } .flex--justify { /* #ifndef APP-NVUE */ justify-content: initial; /* #endif */ } .uni-list--lg { height: $uni-img-size-lg; width: $uni-img-size-lg; } .uni-list--base { height: $uni-img-size-base; width: $uni-img-size-base; } .uni-list--sm { height: $uni-img-size-sm; width: $uni-img-size-sm; } .uni-list-item__extra-text { color: $uni-text-color-grey; font-size: $uni-font-size-sm; } .uni-ellipsis-1 { /* #ifndef APP-NVUE */ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; /* #endif */ /* #ifdef APP-NVUE */ lines: 1; text-overflow: ellipsis; /* #endif */ } .uni-ellipsis-2 { /* #ifndef APP-NVUE */ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; /* #endif */ /* #ifdef APP-NVUE */ lines: 2; text-overflow: ellipsis; /* #endif */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
Vue
unknown
12,645
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uni-load-more/components/uni-load-more/i18n/index.js
JavaScript
unknown
162
<template> <view class="uni-load-more" @click="onClick"> <!-- #ifdef APP-NVUE --> <loading-indicator v-if="!webviewHide && status === 'loading' && showIcon" :style="{color: color,width:iconSize+'px',height:iconSize+'px'}" :animating="true" class="uni-load-more__img uni-load-more__img--nvue"></loading-indicator> <!-- #endif --> <!-- #ifdef H5 --> <svg width="24" height="24" viewBox="25 25 50 50" v-if="!webviewHide && (iconType==='circle' || iconType==='auto' && platform === 'android') && status === 'loading' && showIcon" :style="{width:iconSize+'px',height:iconSize+'px'}" class="uni-load-more__img uni-load-more__img--android-H5"> <circle cx="50" cy="50" r="20" fill="none" :style="{color:color}" :stroke-width="3"></circle> </svg> <!-- #endif --> <!-- #ifndef APP-NVUE || H5 --> <view v-if="!webviewHide && (iconType==='circle' || iconType==='auto' && platform === 'android') && status === 'loading' && showIcon" :style="{width:iconSize+'px',height:iconSize+'px'}" class="uni-load-more__img uni-load-more__img--android-MP"> <view class="uni-load-more__img-icon" :style="{borderTopColor:color,borderTopWidth:iconSize/12}"></view> <view class="uni-load-more__img-icon" :style="{borderTopColor:color,borderTopWidth:iconSize/12}"></view> <view class="uni-load-more__img-icon" :style="{borderTopColor:color,borderTopWidth:iconSize/12}"></view> </view> <!-- #endif --> <!-- #ifndef APP-NVUE --> <view v-else-if="!webviewHide && status === 'loading' && showIcon" :style="{width:iconSize+'px',height:iconSize+'px'}" class="uni-load-more__img uni-load-more__img--ios-H5"> <image :src="imgBase64" mode="widthFix"></image> </view> <!-- #endif --> <text v-if="showText" class="uni-load-more__text" :style="{color: color}">{{ status === 'more' ? contentdownText : status === 'loading' ? contentrefreshText : contentnomoreText }}</text> </view> </template> <script> let platform setTimeout(() => { platform = uni.getSystemInfoSync().platform }, 16) import { initVueI18n } from '@dcloudio/uni-i18n' import messages from './i18n/index.js' const { t } = initVueI18n(messages) /** * LoadMore 加载更多 * @description 用于列表中,做滚动加载使用,展示 loading 的各种状态 * @tutorial https://ext.dcloud.net.cn/plugin?id=29 * @property {String} status = [more|loading|noMore] loading 的状态 * @value more loading前 * @value loading loading中 * @value noMore 没有更多了 * @property {Number} iconSize 指定图标大小 * @property {Boolean} iconSize = [true|false] 是否显示 loading 图标 * @property {String} iconType = [snow|circle|auto] 指定图标样式 * @value snow ios雪花加载样式 * @value circle 安卓唤醒加载样式 * @value auto 根据平台自动选择加载样式 * @property {String} color 图标和文字颜色 * @property {Object} contentText 各状态文字说明,值为:{contentdown: "上拉显示更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"} * @event {Function} clickLoadMore 点击加载更多时触发 */ export default { name: 'UniLoadMore', emits: ['clickLoadMore'], props: { status: { // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了 type: String, default: 'more' }, showIcon: { type: Boolean, default: true }, iconType: { type: String, default: 'auto' }, iconSize: { type: Number, default: 24 }, color: { type: String, default: '#777777' }, contentText: { type: Object, default () { return { contentdown: '', contentrefresh: '', contentnomore: '' } } }, showText: { type: Boolean, default: true } }, data() { return { webviewHide: false, platform: platform, imgBase64: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzlBMzU3OTlEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzlBMzU3OUFEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOUEzNTc5N0Q5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOUEzNTc5OEQ5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pt+ALSwAAA6CSURBVHja1FsLkFZVHb98LM+F5bHL8khA1iSeiyQBCRM+YGqKUnnJTDLGI0BGZlKDIU2MMglUiDApEZvSsZnQtBRJtKwQNKQMFYeRDR10WOLd8ljYXdh+v8v5fR3Od+797t1dnOnO/Ofce77z+J//+b/P+ZqtXbs2sJ9MJhNUV1cHJ06cCJo3bx7EPc2aNcvpy7pWrVoF+/fvDyoqKoI2bdoE9fX1F7TjN8a+EXBn/fkfvw942Tf+wYMHg9mzZwfjxo0LDhw4EPa1x2MbFw/fOGfPng1qa2tzcCkILsLDydq2bRsunpOTMM7TD/W/tZDZhPdeKD+yGxHhdu3aBV27dg3OnDlzMVANMheLAO3btw8KCwuDmpoaX5OxbgUIMEq7K8IcPnw4KCsrC/r37x8cP378/4cAXAB3vqSkJMuiDhTkw+XcuXNhOWbMmKBly5YhUT8xArhyFvP0BfwRsAuwxJZJsm/nzp2DTp06he/OU+cZ64K6o0ePBkOHDg2GDx8e6gEbJ5Q/NHNuAJQ1hgBeHUDlR7nVTkY8rQAvAi4z34vR/mPs1FoRsaCgIJThI0eOBC1atEiFGGV+5MiRoS45efJkqFjJFXV1dQuA012m2WcwTw98fy6CqBdsaiIO4CScrGPHjvk4odhavPquRtFWXEC25VgkREKOCh/qDSq+vn37htzD/mZTOmOc5U7zKzBPEedygWshcDyWvs30igAbU+6oyMgJBCFhwQE0fccxN60Ay9iebbjoDh06hMowjQxT4fXq1SskArmHZpkArvixp/kWzHdMeArExSJEaiXIjjRjRJ4DaAGWpibLzXN3Fm1vA5teBgh3j1Rv3bp1YgKwPdmf2p9zcyNYYgPKMfY0T5f5nNYdw158nJ8QawW4CLKwiOBSEgO/hok2eBydR+3dYH+PLxA5J8Vv0KBBwenTp0P2JWAx6+yFEBfs8lMY+y0SWMBNI9E4ThKi58VKTg3FQZS1RQF1cz27eC0QHMu+3E0SkUowjhVt5VdaWhp07949ZHv2Qd1EjDXM2cla1M0nl3GxAs3J9yREzyTdFVKVFOaE9qRA8GM0WebRuo9JGZKA7Mv2SeS/Z8+eoQ9BArMfFrLGo6jvxbhHbJZnKX2Rzz1O7QhJJ9Cs2ZMaWIyq/zhdeqPNfIoHd58clIQD+JSXl4dKlyIAuBdVXZwFVWKspSSoxE++h8x4k3uCnEhE4I5KwRiFWGOU0QWKiCYLbdoRMRKAu2kQ9vkfLU6dOhX06NEjlH+yMRZSinnuyWnYosVcji8CEA/6Cg2JF+IIUBqnGKUTCNwtwBN4f89RiK1R96DEgO2o0NDmtEdvVFdVVYV+P3UAPUEs6GFwV3PHmXkD4vh74iDFJysVI/MlaQhwKeBNTLYX5VuA8T4/gZxA4MRGFxDB6R7OmYPfyykGRJbyie+XnGYnQIC/coH9+vULiYrxrkL9ZA9+0ykaHIfEpM7ge8TiJ2CsHYwyMfafAF1yCGBHYIbCVDjDjKt7BeB51D+LgQa6OkG7IDYEEtvQ7lnXLKLtLdLuJBpE4gPUXcW2+PkZwOex+4cGDhwYDBkyRL7/HFcEwUGPo/8uWRUpYnfxGHco8HkewLHLyYmAawAPuIFZxhOpDfJQ8gbUv41yORAptMWBNr6oqMhWird5+u+iHmBb2nhjDV7HWBNQTgK8y11l5NetWzc5ULscAtSj7nbNI0skhWeUZCc0W4nyH/jO4Vz0u1IeYhbk4AiwM6tjxIWByHsoZ9qcIBPJd/y+DwPfBESOmCa/QF3WiZHucLlEDpNxcNhmheEOPgdQNx6/VZFQzFZ5TN08AHXQt2Ii3EdyFuUsPtTcGPhW5iMiCNELvz+Gdn9huG4HUJaW/w3g0wxV0XaG7arG2WeKiUWYM4Y7GO5ezshTARbbWGw/DvXkpp/ivVvE0JVoMxN4rpGzJMhE5Pl+xlATsDIqikP9F9D2z3h9nOksEUFhK+qO4rcPkoalMQ/HqJLIyb3F3JdjrCcw1yZ8joyJLR5gCo54etlag7qIoeNh1N1BRYj3DTFJ0elotxPlVzkGuYAmL0VSJVGAJA41c4Z6A3BzTLfn0HYwYKEI6CUAMzZEWvLsIcQOo1AmmyyM72nHJCfYsogflGV6jEk9vyQZXSuq6w4c16NsGcGZbwOPr+H1RkOk2LEzjNepxQkihHSCQ4ynAYNRx2zMKV92CQMWqj8J0BRE8EShxRFN6YrfCRhC0x3r/Zm4IbQCcmJoV0kMamllccR6FjHqUC5F2R/wS2dcymOlfAKOS4KmzQb5cpNC2MC7JhVn5wjXoJ44rYhLh8n0eXOCorJxa7POjbSlCGVczr34/RsAmrcvo9s+wGp3tzVhntxiXiJ4nvEYb4FJkf0O8HocAePmLvCxnL0AORraVekJk6TYjDabRVXfRE2lCN1h6ZQRN1+InUbsCpKwoBZHh0dODN9JBCUffItXxEavTQkUtnfTVAplCWL3JISz29h4NjotnuSsQKJCk8dF+kJR6RARjrqFVmfPnj3ZbK8cIJ0msd6jgHPGtfVTQ8VLmlvh4mct9sobRmPic0DyDQQnx/NlfYUgyz59+oScsH379pAwXABD32nTpoUHIToESeI5mnbE/UqDdyLcafEBf2MCqgC7NwxIbMREJQ0g4D4sfJwnD+AmRrII05cfMWJE+L1169bQr+fip06dGp4oJ83lmYd5wj/EmMa4TaHivo4EeCguYZBnkB5g2aWA69OIEnUHOaGysjIYMGBAMGnSpODYsWPZwCpFmm4lNq+4gSLQA7jcX8DwtjEyRC8wjabnXEx9kfWnTJkSJkAo90xpJVV+FmcVNeYAF5zWngS4C4O91MBxmAv8blLEpbjI5sz9MTdAhcgkCT1RO8mZkAjfiYpTEvStAS53Uw1vAiUGgZ3GpuQEYvoiBqlIan7kSDHnTwJQFNiPu0+5VxCVYhcZIjNrdXUDdp+Eq5AZ3Gkg8QAyVZRZIk4Tl4QAbF9cXJxNYZMAtAokgs4BrNxEpCtteXg7DDTMDKYNSuQdKsnJBek7HxewvxaosWxLYXtw+cJp18217wql4aKCfBNoEu0O5VU+PhctJ0YeXD4C6JQpyrlpSLTojpGGGN5YwNziChdIZLk4lvLcFJ9jMX3QdiImY9bmGQU+TRUL5CHITTRlgF8D9ouD1MfmLoEPl5xokIumZ2cfgMpHt47IW9N64Hsh7wQYYjyIugWuF5fCqYncXRd5vPMWyizzvhi/32+nvG0dZc9vR6fZOu0md5e+uC408FvKSIOZwXlGvxPv95izA2Vtvg1xKFWARI+vMX66HUhpQQb643uW1bSjuTWyw2SBvDrBvjFic1eGGlz5esq3ko9uSIlBRqPuFcCv8F4WIcN12nVaBd0SaYwI6PDDImR11JkqgHcPmQssjxIn6bUshygDFJUTxPMpHk+jfjPgupgdnYV2R/g7xSjtpah8RJBewhwf0gGK6XI92u4wXFEU40afJ4DN4h5LcAd+40HI3JgJecuT0c062W0i2hQJUTcxan3/CMW1PF2K6bbA+Daz4xRs1D3Br1Cm0OihKCqizW78/nXAF/G5TXrEcVzaNMH6CyMswqsAHqDyDLEyou8lwOXnKF8DjI6KjV3KzMBiXkDH8ij/H214J5A596ekrZ3F0zXlWeL7+P5eUrNo3/QwC15uxthuzidy7DzKRwEDaAViiDgKbTbz7CJnzo0bN7pIfIiid8SuPwn25o3QCmpnyjlZkyxPP8EomCJzrGb7GJMx7tNsq4MT2xMUYaiErZOluTzKsnz3gwCeCZyVRZJfYplNEokEjwrPtxlxjeYAk+F1F74VAzPxQRNYYdtpOUvWs8J1sGhBJMNsb7igN8plJs1eSmLIhLKE4rvaCX27gOhLpLOsIzJ7qn/i+wZzcvSOZ23/du8TZjwV8zHIXoP4R3ifBxiFz1dcVpa3aPntPE+c6TmIWE9EtcMmAcPdWAhYhAXxcLOQi9L1WhD1Sc8p1d2oL7XGiRKp8F4A2i8K/nfI+y/gsTDJ/YC/8+AD5Uh04KHiGl+cIFPnBDDrPMjwRGkLXyxO4VGbfQWnDH2v0bVWE3C9QOXlepbgjEfIJQI6XDG3z5ahD9cw2pS78ipB85wyScNTvsVzlzzhL8/jRrnmVjfFJK/m3m4nj9vbgQTguT8XZTjsm672R5uJKEaQmBI/c58gyus8ZDagLpEVSJBIyHp4jn++xqPV71OgQgJYEWOtZ/haxRtKmWOBu8xdBLftWltsY84zE6WIEy/eIOWL+BaayMx+KHtL7EAkqdNDLiEXmEMUHniedtJqg9HmZtfvt26vNi0BdG3Ft3g8ZOf7PAu59TxtzivLNIekyi+wD1i8CuUiD9FXAa8C+/xS3JPmZnomyc7H+fb4/Se0bk41Fel621r4cgVxbq91V4jVqwB7HTe2M7jgB+QWHavZkDRPmZcASoZEmBx6i75bGjPcMdL4/VKGFAGWZkGzPG0XAbdL9A81G5LOmUnC9hHKJeO7dcUMjblSl12867ElFTtaGl20xvvLGPdVz/8TVuU7y0x1PG7vtNg24oz9Uo/Z412++VFWI7Fcog9tu9Lm6gvRmIPv9x1xmQAu6RDkXtbOtlGEmpgD5Nvnyc0dcv0EE6cfdi1HmhMf9wDF3k3gtRvEedhxjpgfqPb9PU9iEJHnyOUA7bQUXh6kq/D7l2iTjWv7XOD530BDr8jIrus+srXjt4MzumJMHuTsBa63YKE1+RR5lBjEikCCnWKWiHdzOgKO+nRIBAF88za/IFmJ3eMZov4CYxGBabcpGL8EYx+SeMXJeRwHNsV/h+vdxeuhEpN3ZyNY78Gm2fknJxVGhyjixPiQvVkNzT1elD9Py/aTAL64Hb9vcYmC9zfdXdT/C1LeGbg4rnBaAihDFJH12W5ulfNCNe/xTsP3bp8ikzJs5BF+5PNfAQYAPaseTdsEcaYAAAAASUVORK5CYII=' } }, computed: { iconSnowWidth() { return (Math.floor(this.iconSize / 24) || 1) * 2 }, contentdownText() { return this.contentText.contentdown || t("uni-load-more.contentdown") }, contentrefreshText() { return this.contentText.contentrefresh || t("uni-load-more.contentrefresh") }, contentnomoreText() { return this.contentText.contentnomore || t("uni-load-more.contentnomore") } }, mounted() { // #ifdef APP-PLUS var pages = getCurrentPages(); var page = pages[pages.length - 1]; var currentWebview = page.$getAppWebview(); currentWebview.addEventListener('hide', () => { this.webviewHide = true }) currentWebview.addEventListener('show', () => { this.webviewHide = false }) // #endif }, methods: { onClick() { this.$emit('clickLoadMore', { detail: { status: this.status, } }) } } } </script> <style lang="scss" > .uni-load-more { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; height: 40px; align-items: center; justify-content: center; } .uni-load-more__text { font-size: 14px; margin-left: 8px; } .uni-load-more__img { width: 24px; height: 24px; // margin-right: 8px; } .uni-load-more__img--nvue { color: #666666; } .uni-load-more__img--android, .uni-load-more__img--ios { width: 24px; height: 24px; transform: rotate(0deg); } /* #ifndef APP-NVUE */ .uni-load-more__img--android { animation: loading-ios 1s 0s linear infinite; } @keyframes loading-android { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .uni-load-more__img--ios-H5 { position: relative; animation: loading-ios-H5 1s 0s step-end infinite; } .uni-load-more__img--ios-H5 image { position: absolute; width: 100%; height: 100%; left: 0; top: 0; } @keyframes loading-ios-H5 { 0% { transform: rotate(0deg); } 8% { transform: rotate(30deg); } 16% { transform: rotate(60deg); } 24% { transform: rotate(90deg); } 32% { transform: rotate(120deg); } 40% { transform: rotate(150deg); } 48% { transform: rotate(180deg); } 56% { transform: rotate(210deg); } 64% { transform: rotate(240deg); } 73% { transform: rotate(270deg); } 82% { transform: rotate(300deg); } 91% { transform: rotate(330deg); } 100% { transform: rotate(360deg); } } /* #endif */ /* #ifdef H5 */ .uni-load-more__img--android-H5 { animation: loading-android-H5-rotate 2s linear infinite; transform-origin: center center; } .uni-load-more__img--android-H5 circle { display: inline-block; animation: loading-android-H5-dash 1.5s ease-in-out infinite; stroke: currentColor; stroke-linecap: round; } @keyframes loading-android-H5-rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes loading-android-H5-dash { 0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -40; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -120; } } /* #endif */ /* #ifndef APP-NVUE || H5 */ .uni-load-more__img--android-MP { position: relative; width: 24px; height: 24px; transform: rotate(0deg); animation: loading-ios 1s 0s ease infinite; } .uni-load-more__img--android-MP .uni-load-more__img-icon { position: absolute; box-sizing: border-box; width: 100%; height: 100%; border-radius: 50%; border: solid 2px transparent; border-top: solid 2px #777777; transform-origin: center; } .uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(1) { animation: loading-android-MP-1 1s 0s linear infinite; } .uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(2) { animation: loading-android-MP-2 1s 0s linear infinite; } .uni-load-more__img--android-MP .uni-load-more__img-icon:nth-child(3) { animation: loading-android-MP-3 1s 0s linear infinite; } @keyframes loading-android { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes loading-android-MP-1 { 0% { transform: rotate(0deg); } 50% { transform: rotate(90deg); } 100% { transform: rotate(360deg); } } @keyframes loading-android-MP-2 { 0% { transform: rotate(0deg); } 50% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } } @keyframes loading-android-MP-3 { 0% { transform: rotate(0deg); } 50% { transform: rotate(270deg); } 100% { transform: rotate(360deg); } } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue
Vue
unknown
14,779
<template> <view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}"> <view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }" :style="{ 'background-color': themeBgColor, 'border-bottom-color':themeColor }" > <status-bar v-if="statusBar" /> <view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}" class="uni-navbar__header"> <view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left" :style="{width:leftIconWidth}"> <slot name="left"> <view class="uni-navbar__content_view" v-if="leftIcon.length > 0"> <uni-icons :color="themeColor" :type="leftIcon" size="20" /> </view> <view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text" v-if="leftText.length"> <text :style="{ color: themeColor, fontSize: '12px' }">{{ leftText }}</text> </view> </slot> </view> <view class="uni-navbar__header-container " @tap="onClickTitle"> <slot> <view class="uni-navbar__header-container-inner" v-if="title.length>0"> <text class="uni-nav-bar-text uni-ellipsis-1" :style="{color: themeColor }">{{ title }}</text> </view> </slot> </view> <view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right" :style="{width:rightIconWidth}"> <slot name="right"> <view v-if="rightIcon.length"> <uni-icons :color="themeColor" :type="rightIcon" size="22" /> </view> <view class="uni-navbar-btn-text" v-if="rightText.length && !rightIcon.length"> <text class="uni-nav-bar-right-text" :style="{ color: themeColor}">{{ rightText }}</text> </view> </slot> </view> </view> </view> <!-- #ifndef APP-NVUE --> <view class="uni-navbar__placeholder" v-if="fixed"> <status-bar v-if="statusBar" /> <view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" /> </view> <!-- #endif --> </view> </template> <script> import statusBar from "./uni-status-bar.vue"; const getVal = (val) => typeof val === 'number' ? val + 'px' : val; /** * * * NavBar 自定义导航栏 * @description 导航栏组件,主要用于头部导航 * @tutorial https://ext.dcloud.net.cn/plugin?id=52 * @property {Boolean} dark 开启黑暗模式 * @property {String} title 标题文字 * @property {String} leftText 左侧按钮文本 * @property {String} rightText 右侧按钮文本 * @property {String} leftIcon 左侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性) * @property {String} rightIcon 右侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性) * @property {String} color 图标和文字颜色 * @property {String} backgroundColor 导航栏背景颜色 * @property {Boolean} fixed = [true|false] 是否固定顶部 * @property {Boolean} statusBar = [true|false] 是否包含状态栏 * @property {Boolean} shadow = [true|false] 导航栏下是否有阴影 * @property {Boolean} stat 是否开启统计标题上报 * @event {Function} clickLeft 左侧按钮点击时触发 * @event {Function} clickRight 右侧按钮点击时触发 * @event {Function} clickTitle 中间标题点击时触发 */ export default { name: "UniNavBar", components: { statusBar }, emits: ['clickLeft', 'clickRight', 'clickTitle'], props: { dark: { type: Boolean, default: false }, title: { type: String, default: "" }, leftText: { type: String, default: "" }, rightText: { type: String, default: "" }, leftIcon: { type: String, default: "" }, rightIcon: { type: String, default: "" }, fixed: { type: [Boolean, String], default: false }, color: { type: String, default: "" }, backgroundColor: { type: String, default: "" }, statusBar: { type: [Boolean, String], default: false }, shadow: { type: [Boolean, String], default: false }, border: { type: [Boolean, String], default: true }, height: { type: [Number, String], default: 44 }, leftWidth: { type: [Number, String], default: 60 }, rightWidth: { type: [Number, String], default: 60 }, stat: { type: [Boolean, String], default: '' } }, computed: { themeBgColor() { if (this.dark) { // 默认值 if (this.backgroundColor) { return this.backgroundColor } else { return this.dark ? '#333' : '#FFF' } } return this.backgroundColor || '#FFF' }, themeColor() { if (this.dark) { // 默认值 if (this.color) { return this.color } else { return this.dark ? '#fff' : '#333' } } return this.color || '#333' }, navbarHeight() { return getVal(this.height) }, leftIconWidth() { return getVal(this.leftWidth) }, rightIconWidth() { return getVal(this.rightWidth) } }, mounted() { if (uni.report && this.stat && this.title !== '') { uni.report('title', this.title) } }, methods: { onClickLeft() { this.$emit("clickLeft"); }, onClickRight() { this.$emit("clickRight"); }, onClickTitle() { this.$emit("clickTitle"); } } }; </script> <style lang="scss" scoped> $nav-height: 44px; .uni-nvue-fixed { /* #ifdef APP-NVUE */ position: sticky; /* #endif */ } .uni-navbar { // box-sizing: border-box; } .uni-nav-bar-text { /* #ifdef APP-PLUS */ font-size: 34rpx; /* #endif */ /* #ifndef APP-PLUS */ font-size: 14px; /* #endif */ } .uni-nav-bar-right-text { font-size: 12px; } .uni-navbar__content { position: relative; // background-color: #fff; // box-sizing: border-box; background-color: transparent; } .uni-navbar__content_view { // box-sizing: border-box; } .uni-navbar-btn-text { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; justify-content: flex-start; align-items: center; line-height: 12px; } .uni-navbar__header { /* #ifndef APP-NVUE */ display: flex; /* #endif */ padding: 0 10px; flex-direction: row; height: $nav-height; font-size: 12px; } .uni-navbar__header-btns { /* #ifndef APP-NVUE */ overflow: hidden; display: flex; /* #endif */ flex-wrap: nowrap; flex-direction: row; width: 120rpx; // padding: 0 6px; justify-content: center; align-items: center; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-navbar__header-btns-left { /* #ifndef APP-NVUE */ display: flex; /* #endif */ width: 120rpx; justify-content: flex-start; align-items: center; } .uni-navbar__header-btns-right { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; // width: 150rpx; // padding-right: 30rpx; justify-content: flex-end; align-items: center; } .uni-navbar__header-container { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; padding: 0 10px; overflow: hidden; } .uni-navbar__header-container-inner { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; align-items: center; justify-content: center; font-size: 12px; overflow: hidden; // box-sizing: border-box; } .uni-navbar__placeholder-view { height: $nav-height; } .uni-navbar--fixed { position: fixed; z-index: 99; /* #ifdef H5 */ left: var(--window-left); right: var(--window-right); /* #endif */ /* #ifndef H5 */ left: 0; right: 0; /* #endif */ } .uni-navbar--shadow { box-shadow: 0 1px 6px #ccc; } .uni-navbar--border { border-bottom-width: 1rpx; border-bottom-style: solid; border-bottom-color: #eee; } .uni-ellipsis-1 { overflow: hidden; /* #ifndef APP-NVUE */ white-space: nowrap; text-overflow: ellipsis; /* #endif */ /* #ifdef APP-NVUE */ lines: 1; text-overflow: ellipsis; /* #endif */ } // 暗主题配置 .uni-dark {} </style>
2301_77169380/AppruanjianApk
uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue
Vue
unknown
8,199
<template> <view :style="{ height: statusBarHeight }" class="uni-status-bar"> <slot /> </view> </template> <script> export default { name: 'UniStatusBar', data() { return { statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px' } } } </script> <style lang="scss" > .uni-status-bar { // width: 750rpx; height: 20px; // height: var(--status-bar-height); } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue
Vue
unknown
404
<template> <view v-if="show" class="uni-noticebar" :style="{ backgroundColor }" @click="onClick"> <uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound" :color="color" :size="fontSize * 1.5" /> <view ref="textBox" class="uni-noticebar__content-wrapper" :class="{ 'uni-noticebar__content-wrapper--scrollable': scrollable, 'uni-noticebar__content-wrapper--single': !scrollable && (single || moreText) }" :style="{ height: scrollable ? fontSize * 1.5 + 'px' : 'auto' }" > <view :id="elIdBox" class="uni-noticebar__content" :class="{ 'uni-noticebar__content--scrollable': scrollable, 'uni-noticebar__content--single': !scrollable && (single || moreText) }" > <text :id="elId" ref="animationEle" class="uni-noticebar__content-text" :class="{ 'uni-noticebar__content-text--scrollable': scrollable, 'uni-noticebar__content-text--single': !scrollable && (single || showGetMore) }" :style="{ color: color, fontSize: fontSize + 'px', lineHeight: fontSize * 1.5 + 'px', width: wrapWidth + 'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration, animationPlayState: webviewHide ? 'paused' : animationPlayState, '-webkit-animationPlayState': webviewHide ? 'paused' : animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay': animationDelay }" >{{text}}</text> </view> </view> <view v-if="isShowGetMore" class="uni-noticebar__more uni-cursor-point" @click="clickMore"> <text v-if="moreText.length > 0" :style="{ color: moreColor, fontSize: fontSize + 'px' }">{{ moreText }}</text> <uni-icons v-else type="right" :color="moreColor" :size="fontSize * 1.1" /> </view> <view class="uni-noticebar-close uni-cursor-point" v-if="isShowClose"> <uni-icons type="closeempty" :color="color" :size="fontSize * 1.1" @click="close" /> </view> </view> </template> <script> // #ifdef APP-NVUE const dom = weex.requireModule('dom'); const animation = weex.requireModule('animation'); // #endif /** * NoticeBar 自定义导航栏 * @description 通告栏组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=30 * @property {Number} speed 文字滚动的速度,默认100px/秒 * @property {String} text 显示文字 * @property {String} backgroundColor 背景颜色 * @property {String} color 文字颜色 * @property {String} moreColor 查看更多文字的颜色 * @property {String} moreText 设置“查看更多”的文本 * @property {Boolean} single = [true|false] 是否单行 * @property {Boolean} scrollable = [true|false] 是否滚动,为true时,NoticeBar为单行 * @property {Boolean} showIcon = [true|false] 是否显示左侧喇叭图标 * @property {Boolean} showClose = [true|false] 是否显示左侧关闭按钮 * @property {Boolean} showGetMore = [true|false] 是否显示右侧查看更多图标,为true时,NoticeBar为单行 * @event {Function} click 点击 NoticeBar 触发事件 * @event {Function} close 关闭 NoticeBar 触发事件 * @event {Function} getmore 点击”查看更多“时触发事件 */ export default { name: 'UniNoticeBar', emits: ['click', 'getmore', 'close'], props: { text: { type: String, default: '' }, moreText: { type: String, default: '' }, backgroundColor: { type: String, default: '#FFF9EA' }, speed: { // 默认1s滚动100px type: Number, default: 100 }, color: { type: String, default: '#FF9A43' }, fontSize: { type: Number, default: 14 }, moreColor: { type: String, default: '#FF9A43' }, single: { // 是否单行 type: [Boolean, String], default: false }, scrollable: { // 是否滚动,添加后控制单行效果取消 type: [Boolean, String], default: false }, showIcon: { // 是否显示左侧icon type: [Boolean, String], default: false }, showGetMore: { // 是否显示右侧查看更多 type: [Boolean, String], default: false }, showClose: { // 是否显示左侧关闭按钮 type: [Boolean, String], default: false } }, data() { const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` const elIdBox = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` return { textWidth: 0, boxWidth: 0, wrapWidth: '', webviewHide: false, // #ifdef APP-NVUE stopAnimation: false, // #endif elId: elId, elIdBox: elIdBox, show: true, animationDuration: 'none', animationPlayState: 'paused', animationDelay: '0s' } }, watch:{ text:function(newValue,oldValue){ this.initSize(); } }, computed: { isShowGetMore() { return this.showGetMore === true || this.showGetMore === 'true' }, isShowClose() { return (this.showClose === true || this.showClose === 'true') && (this.showGetMore === false || this.showGetMore === 'false') } }, mounted() { // #ifdef APP-PLUS var pages = getCurrentPages(); var page = pages[pages.length - 1]; var currentWebview = page.$getAppWebview(); currentWebview.addEventListener('hide', () => { this.webviewHide = true }) currentWebview.addEventListener('show', () => { this.webviewHide = false }) // #endif this.$nextTick(() => { this.initSize() }) }, // #ifdef APP-NVUE beforeDestroy() { this.stopAnimation = true }, // #endif methods: { initSize() { if (this.scrollable) { // #ifndef APP-NVUE let query = [], boxWidth = 0, textWidth = 0; let textQuery = new Promise((resolve, reject) => { uni.createSelectorQuery() // #ifndef MP-ALIPAY .in(this) // #endif .select(`#${this.elId}`) .boundingClientRect() .exec(ret => { this.textWidth = ret[0].width resolve() }) }) let boxQuery = new Promise((resolve, reject) => { uni.createSelectorQuery() // #ifndef MP-ALIPAY .in(this) // #endif .select(`#${this.elIdBox}`) .boundingClientRect() .exec(ret => { this.boxWidth = ret[0].width resolve() }) }) query.push(textQuery) query.push(boxQuery) Promise.all(query).then(() => { this.animationDuration = `${this.textWidth / this.speed}s` this.animationDelay = `-${this.boxWidth / this.speed}s` setTimeout(() => { this.animationPlayState = 'running' }, 1000) }) // #endif // #ifdef APP-NVUE dom.getComponentRect(this.$refs['animationEle'], (res) => { let winWidth = uni.getSystemInfoSync().windowWidth this.textWidth = res.size.width animation.transition(this.$refs['animationEle'], { styles: { transform: `translateX(-${winWidth}px)` }, duration: 0, timingFunction: 'linear', delay: 0 }, () => { if (!this.stopAnimation) { animation.transition(this.$refs['animationEle'], { styles: { transform: `translateX(-${this.textWidth}px)` }, timingFunction: 'linear', duration: (this.textWidth - winWidth) / this.speed * 1000, delay: 1000 }, () => { if (!this.stopAnimation) { this.loopAnimation() } }); } }); }) // #endif } // #ifdef APP-NVUE if (!this.scrollable && (this.single || this.moreText)) { dom.getComponentRect(this.$refs['textBox'], (res) => { this.wrapWidth = res.size.width }) } // #endif }, loopAnimation() { // #ifdef APP-NVUE animation.transition(this.$refs['animationEle'], { styles: { transform: `translateX(0px)` }, duration: 0 }, () => { if (!this.stopAnimation) { animation.transition(this.$refs['animationEle'], { styles: { transform: `translateX(-${this.textWidth}px)` }, duration: this.textWidth / this.speed * 1000, timingFunction: 'linear', delay: 0 }, () => { if (!this.stopAnimation) { this.loopAnimation() } }); } }); // #endif }, clickMore() { this.$emit('getmore') }, close() { this.show = false; this.$emit('close') }, onClick() { this.$emit('click') } } } </script> <style lang="scss" scoped> .uni-noticebar { /* #ifndef APP-NVUE */ display: flex; width: 100%; box-sizing: border-box; /* #endif */ flex-direction: row; align-items: center; padding: 10px 12px; margin-bottom: 10px; } .uni-cursor-point { /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-noticebar-close { margin-left: 8px; margin-right: 5px; } .uni-noticebar-icon { margin-right: 5px; } .uni-noticebar__content-wrapper { flex: 1; flex-direction: column; overflow: hidden; } .uni-noticebar__content-wrapper--single { /* #ifndef APP-NVUE */ line-height: 18px; /* #endif */ } .uni-noticebar__content-wrapper--single, .uni-noticebar__content-wrapper--scrollable { flex-direction: row; } /* #ifndef APP-NVUE */ .uni-noticebar__content-wrapper--scrollable { position: relative; } /* #endif */ .uni-noticebar__content--scrollable { /* #ifdef APP-NVUE */ flex: 0; /* #endif */ /* #ifndef APP-NVUE */ flex: 1; display: block; overflow: hidden; /* #endif */ } .uni-noticebar__content--single { /* #ifndef APP-NVUE */ display: flex; flex: none; width: 100%; justify-content: center; /* #endif */ } .uni-noticebar__content-text { font-size: 14px; line-height: 18px; /* #ifndef APP-NVUE */ word-break: break-all; /* #endif */ } .uni-noticebar__content-text--single { /* #ifdef APP-NVUE */ lines: 1; /* #endif */ /* #ifndef APP-NVUE */ display: block; width: 100%; white-space: nowrap; /* #endif */ overflow: hidden; text-overflow: ellipsis; } .uni-noticebar__content-text--scrollable { /* #ifdef APP-NVUE */ lines: 1; padding-left: 750rpx; /* #endif */ /* #ifndef APP-NVUE */ position: absolute; display: block; height: 18px; line-height: 18px; white-space: nowrap; padding-left: 100%; animation: notice 10s 0s linear infinite both; animation-play-state: paused; /* #endif */ } .uni-noticebar__more { /* #ifndef APP-NVUE */ display: inline-flex; /* #endif */ flex-direction: row; flex-wrap: nowrap; align-items: center; padding-left: 5px; } @keyframes notice { 100% { transform: translate3d(-100%, 0, 0); } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.vue
Vue
unknown
10,733
<template> <view class="uni-numbox"> <view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}"> <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text> </view> <input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" :type="step<1?'digit':'number'" v-model="inputValue" :style="{background, color, width:widthWithPx}" /> <view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}"> <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text> </view> </view> </template> <script> /** * NumberBox 数字输入框 * @description 带加减按钮的数字输入框 * @tutorial https://ext.dcloud.net.cn/plugin?id=31 * @property {Number} value 输入框当前值 * @property {Number} min 最小值 * @property {Number} max 最大值 * @property {Number} step 每次点击改变的间隔大小 * @property {String} background 背景色 * @property {String} color 字体颜色(前景色) * @property {Number} width 输入框宽度(单位:px) * @property {Boolean} disabled = [true|false] 是否为禁用状态 * @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value * @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象 * @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象 */ export default { name: "UniNumberBox", emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'], props: { value: { type: [Number, String], default: 1 }, modelValue: { type: [Number, String], default: 1 }, min: { type: Number, default: 0 }, max: { type: Number, default: 100 }, step: { type: Number, default: 1 }, background: { type: String, default: '#f5f5f5' }, color: { type: String, default: '#333' }, disabled: { type: Boolean, default: false }, width: { type: Number, default: 40, } }, data() { return { inputValue: 0 }; }, watch: { value(val) { this.inputValue = +val; }, modelValue(val) { this.inputValue = +val; } }, computed: { widthWithPx() { return this.width + 'px'; } }, created() { if (this.value === 1) { this.inputValue = +this.modelValue; } if (this.modelValue === 1) { this.inputValue = +this.value; } }, methods: { _calcValue(type) { if (this.disabled) { return; } const scale = this._getDecimalScale(); let value = this.inputValue * scale; let step = this.step * scale; if (type === "minus") { value -= step; if (value < (this.min * scale)) { return; } if (value > (this.max * scale)) { value = this.max * scale } } if (type === "plus") { value += step; if (value > (this.max * scale)) { return; } if (value < (this.min * scale)) { value = this.min * scale } } this.inputValue = (value / scale).toFixed(String(scale).length - 1); // TODO vue2 兼容 this.$emit("input", +this.inputValue); // TODO vue3 兼容 this.$emit("update:modelValue", +this.inputValue); this.$emit("change", +this.inputValue); }, _getDecimalScale() { let scale = 1; // 浮点型 if (~~this.step !== this.step) { scale = Math.pow(10, String(this.step).split(".")[1].length); } return scale; }, _onBlur(event) { this.$emit('blur', event) let value = event.detail.value; if (isNaN(value)) { this.inputValue = this.value; return; } value = +value; if (value > this.max) { value = this.max; } else if (value < this.min) { value = this.min; } const scale = this._getDecimalScale(); this.inputValue = value.toFixed(String(scale).length - 1); this.$emit("input", +this.inputValue); this.$emit("update:modelValue", +this.inputValue); this.$emit("change", +this.inputValue); }, _onFocus(event) { this.$emit('focus', event) } } }; </script> <style lang="scss"> $box-height: 26px; $bg: #f5f5f5; $br: 2px; $color: #333; .uni-numbox { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .uni-numbox-btns { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: center; justify-content: center; padding: 0 8px; background-color: $bg; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-numbox__value { margin: 0 2px; background-color: $bg; width: 40px; height: $box-height; text-align: center; font-size: 14px; border-width: 0; color: $color; } .uni-numbox__minus { border-top-left-radius: $br; border-bottom-left-radius: $br; } .uni-numbox__plus { border-top-right-radius: $br; border-bottom-right-radius: $br; } .uni-numbox--text { // fix nvue line-height: 20px; margin-bottom: 2px; font-size: 20px; font-weight: 300; color: $color; } .uni-numbox .uni-numbox--disabled { color: #c0c0c0 !important; /* #ifdef H5 */ cursor: not-allowed; /* #endif */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
Vue
unknown
5,362
import en from './en.json' import es from './es.json' import fr from './fr.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, es, fr, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uni-pagination/components/uni-pagination/i18n/index.js
JavaScript
unknown
226
<template> <view class="uni-pagination"> <!-- #ifndef MP --> <picker v-if="showPageSize === true || showPageSize === 'true'" class="select-picker" mode="selector" :value="pageSizeIndex" :range="pageSizeRange" @change="pickerChange" @cancel="pickerClick" @click.native="pickerClick"> <button type="default" size="mini" :plain="true"> <text>{{pageSizeRange[pageSizeIndex]}} {{piecePerPage}}</text> <uni-icons class="select-picker-icon" type="arrowdown" size="12" color="#999"></uni-icons> </button> </picker> <!-- #endif --> <!-- #ifndef APP-NVUE --> <view class="uni-pagination__total is-phone-hide">共 {{ total }} 条</view> <!-- #endif --> <view class="uni-pagination__btn" :class="currentIndex === 1 ? 'uni-pagination--disabled' : 'uni-pagination--enabled'" :hover-class="currentIndex === 1 ? '' : 'uni-pagination--hover'" :hover-start-time="20" :hover-stay-time="70" @click="clickLeft"> <template v-if="showIcon === true || showIcon === 'true'"> <uni-icons color="#666" size="16" type="left" /> </template> <template v-else> <text class="uni-pagination__child-btn">{{ prevPageText }}</text> </template> </view> <view class="uni-pagination__num uni-pagination__num-flex-none"> <view class="uni-pagination__num-current"> <text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}</text> <text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text> <!-- #ifndef APP-NVUE --> <view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }" class="uni-pagination__num-tag tag--active is-phone-hide" @click.top="selectPage(item, index)"> <text>{{ item }}</text> </view> <!-- #endif --> </view> </view> <view class="uni-pagination__btn" :class="currentIndex >= maxPage ? 'uni-pagination--disabled' : 'uni-pagination--enabled'" :hover-class="currentIndex === maxPage ? '' : 'uni-pagination--hover'" :hover-start-time="20" :hover-stay-time="70" @click="clickRight"> <template v-if="showIcon === true || showIcon === 'true'"> <uni-icons color="#666" size="16" type="right" /> </template> <template v-else> <text class="uni-pagination__child-btn">{{ nextPageText }}</text> </template> </view> </view> </template> <script> /** * Pagination 分页器 * @description 分页器组件,用于展示页码、请求数据等 * @tutorial https://ext.dcloud.net.cn/plugin?id=32 * @property {String} prevText 左侧按钮文字 * @property {String} nextText 右侧按钮文字 * @property {String} piecePerPageText 条/页文字 * @property {Number} current 当前页 * @property {Number} total 数据总量 * @property {Number} pageSize 每页数据量 * @property {Boolean} showIcon = [true|false] 是否以 icon 形式展示按钮 * @property {Boolean} showPageSize = [true|false] 是否展示每页条数 * @property {Array} pageSizeRange = [20, 50, 100, 500] 每页条数选框 * @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页,type值为:next/prev,表示点击的是上一页还是下一个 * * @event {Function} pageSizeChange 当前每页条数改变时触发 ,e={pageSize} pageSize 为当前所选的每页条数 */ import { initVueI18n } from '@dcloudio/uni-i18n' import messages from './i18n/index.js' const { t } = initVueI18n(messages) export default { name: 'UniPagination', emits: ['update:modelValue', 'input', 'change', 'pageSizeChange'], props: { value: { type: [Number, String], default: 1 }, modelValue: { type: [Number, String], default: 1 }, prevText: { type: String, }, nextText: { type: String, }, piecePerPageText: { type: String }, current: { type: [Number, String], default: 1 }, total: { // 数据总量 type: [Number, String], default: 0 }, pageSize: { // 每页数据量 type: [Number, String], default: 10 }, showIcon: { // 是否以 icon 形式展示按钮 type: [Boolean, String], default: false }, showPageSize: { // 是否以 icon 形式展示按钮 type: [Boolean, String], default: false }, pagerCount: { type: Number, default: 7 }, pageSizeRange: { type: Array, default: () => [20, 50, 100, 500] } }, data() { return { pageSizeIndex: 0, currentIndex: 1, paperData: [], pickerShow: false } }, computed: { piecePerPage() { return this.piecePerPageText || t('uni-pagination.piecePerPage') }, prevPageText() { return this.prevText || t('uni-pagination.prevText') }, nextPageText() { return this.nextText || t('uni-pagination.nextText') }, maxPage() { let maxPage = 1 let total = Number(this.total) let pageSize = Number(this.pageSize) if (total && pageSize) { maxPage = Math.ceil(total / pageSize) } return maxPage }, paper() { const num = this.currentIndex // TODO 最大页数 const pagerCount = this.pagerCount // const total = 181 const total = this.total const pageSize = this.pageSize let totalArr = [] let showPagerArr = [] let pagerNum = Math.ceil(total / pageSize) for (let i = 0; i < pagerNum; i++) { totalArr.push(i + 1) } showPagerArr.push(1) const totalNum = totalArr[totalArr.length - (pagerCount + 1) / 2] totalArr.forEach((item, index) => { if ((pagerCount + 1) / 2 >= num) { if (item < pagerCount + 1 && item > 1) { showPagerArr.push(item) } } else if (num + 2 <= totalNum) { if (item > num - (pagerCount + 1) / 2 && item < num + (pagerCount + 1) / 2) { showPagerArr.push(item) } } else { if ((item > num - (pagerCount + 1) / 2 || pagerNum - pagerCount < item) && item < totalArr[ totalArr.length - 1]) { showPagerArr.push(item) } } }) if (pagerNum > pagerCount) { if ((pagerCount + 1) / 2 >= num) { showPagerArr[showPagerArr.length - 1] = '...' } else if (num + 2 <= totalNum) { showPagerArr[1] = '...' showPagerArr[showPagerArr.length - 1] = '...' } else { showPagerArr[1] = '...' } showPagerArr.push(totalArr[totalArr.length - 1]) } else { if ((pagerCount + 1) / 2 >= num) {} else if (num + 2 <= totalNum) {} else { showPagerArr.shift() showPagerArr.push(totalArr[totalArr.length - 1]) } } return showPagerArr } }, watch: { current: { immediate: true, handler(val, old) { if (val < 1) { this.currentIndex = 1 } else { this.currentIndex = val } } }, value: { immediate: true, handler(val) { if (Number(this.current) !== 1) return if (val < 1) { this.currentIndex = 1 } else { this.currentIndex = val } } }, pageSizeIndex(val) { this.$emit('pageSizeChange', this.pageSizeRange[val]) } }, methods: { pickerChange(e) { this.pageSizeIndex = e.detail.value this.pickerClick() }, pickerClick() { // #ifdef H5 const body = document.querySelector('body') if (!body) return const className = 'uni-pagination-picker-show' this.pickerShow = !this.pickerShow if (this.pickerShow) { body.classList.add(className) } else { setTimeout(() => body.classList.remove(className), 300) } // #endif }, // 选择标签 selectPage(e, index) { if (parseInt(e)) { this.currentIndex = e this.change('current') } else { let pagerNum = Math.ceil(this.total / this.pageSize) // let pagerNum = Math.ceil(181 / this.pageSize) // 上一页 if (index <= 1) { if (this.currentIndex - 5 > 1) { this.currentIndex -= 5 } else { this.currentIndex = 1 } return } // 下一页 if (index >= 6) { if (this.currentIndex + 5 > pagerNum) { this.currentIndex = pagerNum } else { this.currentIndex += 5 } return } } }, clickLeft() { if (Number(this.currentIndex) === 1) { return } this.currentIndex -= 1 this.change('prev') }, clickRight() { if (Number(this.currentIndex) >= this.maxPage) { return } this.currentIndex += 1 this.change('next') }, change(e) { this.$emit('input', this.currentIndex) this.$emit('update:modelValue', this.currentIndex) this.$emit('change', { type: e, current: this.currentIndex }) } } } </script> <style lang="scss" scoped> $uni-primary: #2979ff !default; .uni-pagination { /* #ifndef APP-NVUE */ display: flex; /* #endif */ position: relative; overflow: hidden; flex-direction: row; justify-content: center; align-items: center; } .uni-pagination__total { font-size: 14px; color: #999; margin-right: 15px; } .uni-pagination__btn { /* #ifndef APP-NVUE */ display: flex; cursor: pointer; /* #endif */ padding: 0 8px; line-height: 30px; font-size: 12px; position: relative; background-color: #F0F0F0; flex-direction: row; justify-content: center; align-items: center; text-align: center; border-radius: 5px; // border-width: 1px; // border-style: solid; // border-color: $uni-border-color; } .uni-pagination__child-btn { /* #ifndef APP-NVUE */ display: flex; /* #endif */ font-size: 12px; position: relative; flex-direction: row; justify-content: center; align-items: center; text-align: center; color: #666; font-size: 12px; } .uni-pagination__num { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; justify-content: center; align-items: center; height: 30px; line-height: 30px; font-size: 12px; color: #666; margin: 0 5px; } .uni-pagination__num-tag { /* #ifdef H5 */ cursor: pointer; min-width: 30px; /* #endif */ margin: 0 5px; height: 30px; text-align: center; line-height: 30px; // border: 1px red solid; color: #999; border-radius: 4px; // border-width: 1px; // border-style: solid; // border-color: $uni-border-color; } .uni-pagination__num-current { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .uni-pagination__num-current-text { font-size: 15px; } .current-index-text{ color: $uni-primary; } .uni-pagination--enabled { color: #333333; opacity: 1; } .uni-pagination--disabled { opacity: 0.5; /* #ifdef H5 */ cursor: default; /* #endif */ } .uni-pagination--hover { color: rgba(0, 0, 0, 0.6); background-color: #eee; } .tag--active:hover { color: $uni-primary; } .page--active { color: #fff; background-color: $uni-primary; } .page--active:hover { color: #fff; } /* #ifndef APP-NVUE */ .is-pc-hide { display: block; } .is-phone-hide { display: none; } @media screen and (min-width: 450px) { .is-pc-hide { display: none; } .is-phone-hide { display: block; } .uni-pagination__num-flex-none { flex: none; } } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue
Vue
unknown
11,235
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup/i18n/index.js
JavaScript
unknown
162
// #ifdef H5 export default { name: 'Keypress', props: { disable: { type: Boolean, default: false } }, mounted () { const keyNames = { esc: ['Esc', 'Escape'], tab: 'Tab', enter: 'Enter', space: [' ', 'Spacebar'], up: ['Up', 'ArrowUp'], left: ['Left', 'ArrowLeft'], right: ['Right', 'ArrowRight'], down: ['Down', 'ArrowDown'], delete: ['Backspace', 'Delete', 'Del'] } const listener = ($event) => { if (this.disable) { return } const keyName = Object.keys(keyNames).find(key => { const keyName = $event.key const value = keyNames[key] return value === keyName || (Array.isArray(value) && value.includes(keyName)) }) if (keyName) { // 避免和其他按键事件冲突 setTimeout(() => { this.$emit(keyName, {}) }, 0) } } document.addEventListener('keyup', listener) // this.$once('hook:beforeDestroy', () => { // document.removeEventListener('keyup', listener) // }) }, render: () => {} } // #endif
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup/keypress.js
JavaScript
unknown
1,119
export default { data() { return { } }, created(){ this.popup = this.getParent() }, methods:{ /** * 获取父元素实例 */ getParent(name = 'uniPopup') { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false parentName = parent.$options.name; } return parent; }, } }
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup/popup.js
JavaScript
unknown
418
<template> <view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']"> <view @touchstart="touchstart"> <uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" /> <uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap"> <view class="uni-popup__wrapper" :style="getStyles" :class="[popupstyle]" @click="clear"> <slot /> </view> </uni-transition> </view> <!-- #ifdef H5 --> <keypress v-if="maskShow" @esc="onTap" /> <!-- #endif --> </view> </template> <script> // #ifdef H5 import keypress from './keypress.js' // #endif /** * PopUp 弹出层 * @description 弹出层组件,为了解决遮罩弹层的问题 * @tutorial https://ext.dcloud.net.cn/plugin?id=329 * @property {String} type = [top|center|bottom|left|right|message|dialog|share] 弹出方式 * @value top 顶部弹出 * @value center 中间弹出 * @value bottom 底部弹出 * @value left 左侧弹出 * @value right 右侧弹出 * @value message 消息提示 * @value dialog 对话框 * @value share 底部分享示例 * @property {Boolean} animation = [true|false] 是否开启动画 * @property {Boolean} maskClick = [true|false] 蒙版点击是否关闭弹窗(废弃) * @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗 * @property {String} backgroundColor 主窗口背景色 * @property {String} maskBackgroundColor 蒙版颜色 * @property {String} borderRadius 设置圆角(左上、右上、右下和左下) 示例:"10px 10px 10px 10px" * @property {Boolean} safeArea 是否适配底部安全区 * @event {Function} change 打开关闭弹窗触发,e={show: false} * @event {Function} maskClick 点击遮罩触发 */ export default { name: 'uniPopup', components: { // #ifdef H5 keypress // #endif }, emits: ['change', 'maskClick'], props: { // 开启动画 animation: { type: Boolean, default: true }, // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层 // message: 消息提示 ; dialog : 对话框 type: { type: String, default: 'center' }, // maskClick isMaskClick: { type: Boolean, default: null }, // TODO 2 个版本后废弃属性 ,使用 isMaskClick maskClick: { type: Boolean, default: null }, backgroundColor: { type: String, default: 'none' }, safeArea: { type: Boolean, default: true }, maskBackgroundColor: { type: String, default: 'rgba(0, 0, 0, 0.4)' }, borderRadius:{ type: String, } }, watch: { /** * 监听type类型 */ type: { handler: function(type) { if (!this.config[type]) return this[this.config[type]](true) }, immediate: true }, isDesktop: { handler: function(newVal) { if (!this.config[newVal]) return this[this.config[this.type]](true) }, immediate: true }, /** * 监听遮罩是否可点击 * @param {Object} val */ maskClick: { handler: function(val) { this.mkclick = val }, immediate: true }, isMaskClick: { handler: function(val) { this.mkclick = val }, immediate: true }, // H5 下禁止底部滚动 showPopup(show) { // #ifdef H5 // fix by mehaotian 处理 h5 滚动穿透的问题 document.getElementsByTagName('body')[0].style.overflow = show ? 'hidden' : 'visible' // #endif } }, data() { return { duration: 300, ani: [], showPopup: false, showTrans: false, popupWidth: 0, popupHeight: 0, config: { top: 'top', bottom: 'bottom', center: 'center', left: 'left', right: 'right', message: 'top', dialog: 'center', share: 'bottom' }, maskClass: { position: 'fixed', bottom: 0, top: 0, left: 0, right: 0, backgroundColor: 'rgba(0, 0, 0, 0.4)' }, transClass: { backgroundColor: 'transparent', borderRadius: this.borderRadius || "0", position: 'fixed', left: 0, right: 0 }, maskShow: true, mkclick: true, popupstyle: 'top' } }, computed: { getStyles() { let res = { backgroundColor: this.bg }; if (this.borderRadius || "0") { res = Object.assign(res, { borderRadius: this.borderRadius }) } return res; }, isDesktop() { return this.popupWidth >= 500 && this.popupHeight >= 500 }, bg() { if (this.backgroundColor === '' || this.backgroundColor === 'none') { return 'transparent' } return this.backgroundColor } }, mounted() { const fixSize = () => { const { windowWidth, windowHeight, windowTop, safeArea, screenHeight, safeAreaInsets } = uni.getSystemInfoSync() this.popupWidth = windowWidth this.popupHeight = windowHeight + (windowTop || 0) // TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复 if (safeArea && this.safeArea) { // #ifdef MP-WEIXIN this.safeAreaInsets = screenHeight - safeArea.bottom // #endif // #ifndef MP-WEIXIN this.safeAreaInsets = safeAreaInsets.bottom // #endif } else { this.safeAreaInsets = 0 } } fixSize() // #ifdef H5 // window.addEventListener('resize', fixSize) // this.$once('hook:beforeDestroy', () => { // window.removeEventListener('resize', fixSize) // }) // #endif }, // #ifndef VUE3 // TODO vue2 destroyed() { this.setH5Visible() }, // #endif // #ifdef VUE3 // TODO vue3 unmounted() { this.setH5Visible() }, // #endif activated() { this.setH5Visible(!this.showPopup); }, deactivated() { this.setH5Visible(true); }, created() { // this.mkclick = this.isMaskClick || this.maskClick if (this.isMaskClick === null && this.maskClick === null) { this.mkclick = true } else { this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick } if (this.animation) { this.duration = 300 } else { this.duration = 0 } // TODO 处理 message 组件生命周期异常的问题 this.messageChild = null // TODO 解决头条冒泡的问题 this.clearPropagation = false this.maskClass.backgroundColor = this.maskBackgroundColor }, methods: { setH5Visible(visible = true) { // #ifdef H5 // fix by mehaotian 处理 h5 滚动穿透的问题 document.getElementsByTagName('body')[0].style.overflow = visible ? "visible" : "hidden"; // #endif }, /** * 公用方法,不显示遮罩层 */ closeMask() { this.maskShow = false }, /** * 公用方法,遮罩层禁止点击 */ disableMask() { this.mkclick = false }, // TODO nvue 取消冒泡 clear(e) { // #ifndef APP-NVUE e.stopPropagation() // #endif this.clearPropagation = true }, open(direction) { // fix by mehaotian 处理快速打开关闭的情况 if (this.showPopup) { return } let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share'] if (!(direction && innerType.indexOf(direction) !== -1)) { direction = this.type } if (!this.config[direction]) { console.error('缺少类型:', direction) return } this[this.config[direction]]() this.$emit('change', { show: true, type: direction }) }, close(type) { this.showTrans = false this.$emit('change', { show: false, type: this.type }) clearTimeout(this.timer) // // 自定义关闭事件 // this.customOpen && this.customClose() this.timer = setTimeout(() => { this.showPopup = false }, 300) }, // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容 touchstart() { this.clearPropagation = false }, onTap() { if (this.clearPropagation) { // fix by mehaotian 兼容 nvue this.clearPropagation = false return } this.$emit('maskClick') if (!this.mkclick) return this.close() }, /** * 顶部弹出样式处理 */ top(type) { this.popupstyle = this.isDesktop ? 'fixforpc-top' : 'top' this.ani = ['slide-top'] this.transClass = { position: 'fixed', left: 0, right: 0, backgroundColor: this.bg, borderRadius:this.borderRadius || "0" } // TODO 兼容 type 属性 ,后续会废弃 if (type) return this.showPopup = true this.showTrans = true this.$nextTick(() => { if (this.messageChild && this.type === 'message') { this.messageChild.timerClose() } }) }, /** * 底部弹出样式处理 */ bottom(type) { this.popupstyle = 'bottom' this.ani = ['slide-bottom'] this.transClass = { position: 'fixed', left: 0, right: 0, bottom: 0, paddingBottom: this.safeAreaInsets + 'px', backgroundColor: this.bg, borderRadius:this.borderRadius || "0", } // TODO 兼容 type 属性 ,后续会废弃 if (type) return this.showPopup = true this.showTrans = true }, /** * 中间弹出样式处理 */ center(type) { this.popupstyle = 'center' //微信小程序下,组合动画会出现文字向上闪动问题,再此做特殊处理 // #ifdef MP-WEIXIN this.ani = ['fade'] // #endif // #ifndef MP-WEIXIN this.ani = ['zoom-out', 'fade'] // #endif this.transClass = { position: 'fixed', /* #ifndef APP-NVUE */ display: 'flex', flexDirection: 'column', /* #endif */ bottom: 0, left: 0, right: 0, top: 0, justifyContent: 'center', alignItems: 'center', borderRadius:this.borderRadius || "0" } // TODO 兼容 type 属性 ,后续会废弃 if (type) return this.showPopup = true this.showTrans = true }, left(type) { this.popupstyle = 'left' this.ani = ['slide-left'] this.transClass = { position: 'fixed', left: 0, bottom: 0, top: 0, backgroundColor: this.bg, borderRadius:this.borderRadius || "0", /* #ifndef APP-NVUE */ display: 'flex', flexDirection: 'column' /* #endif */ } // TODO 兼容 type 属性 ,后续会废弃 if (type) return this.showPopup = true this.showTrans = true }, right(type) { this.popupstyle = 'right' this.ani = ['slide-right'] this.transClass = { position: 'fixed', bottom: 0, right: 0, top: 0, backgroundColor: this.bg, borderRadius:this.borderRadius || "0", /* #ifndef APP-NVUE */ display: 'flex', flexDirection: 'column' /* #endif */ } // TODO 兼容 type 属性 ,后续会废弃 if (type) return this.showPopup = true this.showTrans = true } } } </script> <style lang="scss"> .uni-popup { position: fixed; /* #ifndef APP-NVUE */ z-index: 99; /* #endif */ &.top, &.left, &.right { /* #ifdef H5 */ top: var(--window-top); /* #endif */ /* #ifndef H5 */ top: 0; /* #endif */ } .uni-popup__wrapper { /* #ifndef APP-NVUE */ display: block; /* #endif */ position: relative; /* iphonex 等安全区设置,底部安全区适配 */ /* #ifndef APP-NVUE */ // padding-bottom: constant(safe-area-inset-bottom); // padding-bottom: env(safe-area-inset-bottom); /* #endif */ &.left, &.right { /* #ifdef H5 */ padding-top: var(--window-top); /* #endif */ /* #ifndef H5 */ padding-top: 0; /* #endif */ flex: 1; } } } .fixforpc-z-index { /* #ifndef APP-NVUE */ z-index: 999; /* #endif */ } .fixforpc-top { top: 0; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup/uni-popup.vue
Vue
unknown
12,046
// #ifdef H5 export default { name: 'Keypress', props: { disable: { type: Boolean, default: false } }, mounted () { const keyNames = { esc: ['Esc', 'Escape'], tab: 'Tab', enter: 'Enter', space: [' ', 'Spacebar'], up: ['Up', 'ArrowUp'], left: ['Left', 'ArrowLeft'], right: ['Right', 'ArrowRight'], down: ['Down', 'ArrowDown'], delete: ['Backspace', 'Delete', 'Del'] } const listener = ($event) => { if (this.disable) { return } const keyName = Object.keys(keyNames).find(key => { const keyName = $event.key const value = keyNames[key] return value === keyName || (Array.isArray(value) && value.includes(keyName)) }) if (keyName) { // 避免和其他按键事件冲突 setTimeout(() => { this.$emit(keyName, {}) }, 0) } } document.addEventListener('keyup', listener) this.$once('hook:beforeDestroy', () => { document.removeEventListener('keyup', listener) }) }, render: () => {} } // #endif
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
JavaScript
unknown
1,110
<template> <view class="uni-popup-dialog"> <view class="uni-dialog-title"> <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text> </view> <view v-if="mode === 'base'" class="uni-dialog-content"> <slot> <text class="uni-dialog-content-text">{{content}}</text> </slot> </view> <view v-else class="uni-dialog-content"> <slot> <input class="uni-dialog-input" :maxlength="maxlength" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus"> </slot> </view> <view class="uni-dialog-button-group"> <view class="uni-dialog-button" v-if="showClose" @click="closeDialog"> <text class="uni-dialog-button-text">{{closeText}}</text> </view> <view class="uni-dialog-button" :class="showClose?'uni-border-left':''" @click="onOk"> <text class="uni-dialog-button-text uni-button-color">{{okText}}</text> </view> </view> </view> </template> <script> import popup from '../uni-popup/popup.js' import { initVueI18n } from '@dcloudio/uni-i18n' import messages from '../uni-popup/i18n/index.js' const { t } = initVueI18n(messages) /** * PopUp 弹出层-对话框样式 * @description 弹出层-对话框样式 * @tutorial https://ext.dcloud.net.cn/plugin?id=329 * @property {String} value input 模式下的默认值 * @property {String} placeholder input 模式下输入提示 * @property {Boolean} focus input模式下是否自动聚焦,默认为true * @property {String} type = [success|warning|info|error] 主题样式 * @value success 成功 * @value warning 提示 * @value info 消息 * @value error 错误 * @property {String} mode = [base|input] 模式、 * @value base 基础对话框 * @value input 可输入对话框 * @showClose {Boolean} 是否显示关闭按钮 * @property {String} content 对话框内容 * @property {Boolean} beforeClose 是否拦截取消事件 * @property {Number} maxlength 输入 * @event {Function} confirm 点击确认按钮触发 * @event {Function} close 点击取消按钮触发 */ export default { name: "uniPopupDialog", mixins: [popup], emits: ['confirm', 'close', 'update:modelValue', 'input'], props: { inputType: { type: String, default: 'text' }, showClose: { type: Boolean, default: true }, // #ifdef VUE2 value: { type: [String, Number], default: '' }, // #endif // #ifdef VUE3 modelValue: { type: [Number, String], default: '' }, // #endif placeholder: { type: [String, Number], default: '' }, type: { type: String, default: 'error' }, mode: { type: String, default: 'base' }, title: { type: String, default: '' }, content: { type: String, default: '' }, beforeClose: { type: Boolean, default: false }, cancelText: { type: String, default: '' }, confirmText: { type: String, default: '' }, maxlength: { type: Number, default: -1, }, focus: { type: Boolean, default: true, } }, data() { return { dialogType: 'error', val: "" } }, computed: { okText() { return this.confirmText || t("uni-popup.ok") }, closeText() { return this.cancelText || t("uni-popup.cancel") }, placeholderText() { return this.placeholder || t("uni-popup.placeholder") }, titleText() { return this.title || t("uni-popup.title") } }, watch: { type(val) { this.dialogType = val }, mode(val) { if (val === 'input') { this.dialogType = 'info' } }, value(val) { if (this.maxlength != -1 && this.mode === 'input') { this.val = val.slice(0, this.maxlength); } else { this.val = val } }, val(val) { // #ifdef VUE2 // TODO 兼容 vue2 this.$emit('input', val); // #endif // #ifdef VUE3 // TODO 兼容 vue3 this.$emit('update:modelValue', val); // #endif } }, created() { // 对话框遮罩不可点击 this.popup.disableMask() // this.popup.closeMask() if (this.mode === 'input') { this.dialogType = 'info' this.val = this.value; // #ifdef VUE3 this.val = this.modelValue; // #endif } else { this.dialogType = this.type } }, methods: { /** * 点击确认按钮 */ onOk() { if (this.mode === 'input') { this.$emit('confirm', this.val) } else { this.$emit('confirm') } if (this.beforeClose) return this.popup.close() }, /** * 点击取消按钮 */ closeDialog() { this.$emit('close') if (this.beforeClose) return this.popup.close() }, close() { this.popup.close() } } } </script> <style lang="scss"> .uni-popup-dialog { width: 300px; border-radius: 11px; background-color: #fff; } .uni-dialog-title { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; padding-top: 25px; } .uni-dialog-title-text { font-size: 16px; font-weight: 500; } .uni-dialog-content { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; align-items: center; padding: 20px; } .uni-dialog-content-text { font-size: 14px; color: #6C6C6C; } .uni-dialog-button-group { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; border-top-color: #f5f5f5; border-top-style: solid; border-top-width: 1px; } .uni-dialog-button { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; justify-content: center; align-items: center; height: 45px; } .uni-border-left { border-left-color: #f0f0f0; border-left-style: solid; border-left-width: 1px; } .uni-dialog-button-text { font-size: 16px; color: #333; } .uni-button-color { color: #007aff; } .uni-dialog-input { flex: 1; font-size: 14px; border: 1px #eee solid; height: 40px; padding: 0 10px; border-radius: 5px; color: #555; } .uni-popup__success { color: #4cd964; } .uni-popup__warn { color: #f0ad4e; } .uni-popup__error { color: #dd524d; } .uni-popup__info { color: #909399; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
Vue
unknown
6,285
<template> <view class="uni-popup-message"> <view class="uni-popup-message__box fixforpc-width" :class="'uni-popup__'+type"> <slot> <text class="uni-popup-message-text" :class="'uni-popup__'+type+'-text'">{{message}}</text> </slot> </view> </view> </template> <script> import popup from '../uni-popup/popup.js' /** * PopUp 弹出层-消息提示 * @description 弹出层-消息提示 * @tutorial https://ext.dcloud.net.cn/plugin?id=329 * @property {String} type = [success|warning|info|error] 主题样式 * @value success 成功 * @value warning 提示 * @value info 消息 * @value error 错误 * @property {String} message 消息提示文字 * @property {String} duration 显示时间,设置为 0 则不会自动关闭 */ export default { name: 'uniPopupMessage', mixins:[popup], props: { /** * 主题 success/warning/info/error 默认 success */ type: { type: String, default: 'success' }, /** * 消息文字 */ message: { type: String, default: '' }, /** * 显示时间,设置为 0 则不会自动关闭 */ duration: { type: Number, default: 3000 }, maskShow:{ type:Boolean, default:false } }, data() { return {} }, created() { this.popup.maskShow = this.maskShow this.popup.messageChild = this }, methods: { timerClose(){ if(this.duration === 0) return clearTimeout(this.timer) this.timer = setTimeout(()=>{ this.popup.close() },this.duration) } } } </script> <style lang="scss" > .uni-popup-message { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; } .uni-popup-message__box { background-color: #e1f3d8; padding: 10px 15px; border-color: #eee; border-style: solid; border-width: 1px; flex: 1; } @media screen and (min-width: 500px) { .fixforpc-width { margin-top: 20px; border-radius: 4px; flex: none; min-width: 380px; /* #ifndef APP-NVUE */ max-width: 50%; /* #endif */ /* #ifdef APP-NVUE */ max-width: 500px; /* #endif */ } } .uni-popup-message-text { font-size: 14px; padding: 0; } .uni-popup__success { background-color: #e1f3d8; } .uni-popup__success-text { color: #67C23A; } .uni-popup__warn { background-color: #faecd8; } .uni-popup__warn-text { color: #E6A23C; } .uni-popup__error { background-color: #fde2e2; } .uni-popup__error-text { color: #F56C6C; } .uni-popup__info { background-color: #F2F6FC; } .uni-popup__info-text { color: #909399; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
Vue
unknown
2,630
<template> <view class="uni-popup-share"> <view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view> <view class="uni-share-content"> <view class="uni-share-content-box"> <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)"> <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image> <text class="uni-share-text">{{item.text}}</text> </view> </view> </view> <view class="uni-share-button-box"> <button class="uni-share-button" @click="close">{{cancelText}}</button> </view> </view> </template> <script> import popup from '../uni-popup/popup.js' import { initVueI18n } from '@dcloudio/uni-i18n' import messages from '../uni-popup/i18n/index.js' const { t } = initVueI18n(messages) export default { name: 'UniPopupShare', mixins:[popup], emits:['select'], props: { title: { type: String, default: '' }, beforeClose: { type: Boolean, default: false } }, data() { return { bottomData: [{ text: '微信', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/c2b17470-50be-11eb-b680-7980c8a877b8.png', name: 'wx' }, { text: '支付宝', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png', name: 'ali' }, { text: 'QQ', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/e7a79520-50be-11eb-b997-9918a5dda011.png', name: 'qq' }, { text: '新浪', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png', name: 'sina' }, // { // text: '百度', // icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png', // name: 'copy' // }, // { // text: '其他', // icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png', // name: 'more' // } ] } }, created() {}, computed: { cancelText() { return t("uni-popup.cancel") }, shareTitleText() { return this.title || t("uni-popup.shareTitle") } }, methods: { /** * 选择内容 */ select(item, index) { this.$emit('select', { item, index }) this.close() }, /** * 关闭窗口 */ close() { if(this.beforeClose) return this.popup.close() } } } </script> <style lang="scss" > .uni-popup-share { background-color: #fff; border-top-left-radius: 11px; border-top-right-radius: 11px; } .uni-share-title { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: center; justify-content: center; height: 40px; } .uni-share-title-text { font-size: 14px; color: #666; } .uni-share-content { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; padding-top: 10px; } .uni-share-content-box { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; flex-wrap: wrap; width: 360px; } .uni-share-content-item { width: 90px; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; justify-content: center; padding: 10px 0; align-items: center; } .uni-share-content-item:active { background-color: #f5f5f5; } .uni-share-image { width: 30px; height: 30px; } .uni-share-text { margin-top: 10px; font-size: 14px; color: #3B4144; } .uni-share-button-box { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; padding: 10px 15px; } .uni-share-button { flex: 1; border-radius: 50px; color: #666; font-size: 16px; } .uni-share-button::after { border-radius: 50px; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
Vue
unknown
3,892
<template> <view> <view ref="uni-rate" class="uni-rate"> <view class="uni-rate__icon" :class="{'uni-cursor-not-allowed': disabled}" :style="{ 'margin-right': marginNumber + 'px' }" v-for="(star, index) in stars" :key="index" @touchstart.stop="touchstart" @touchmove.stop="touchmove" @mousedown.stop="mousedown" @mousemove.stop="mousemove" @mouseleave="mouseleave"> <uni-icons :color="color" :size="size" :type="isFill ? 'star-filled' : 'star'" /> <!-- #ifdef APP-NVUE --> <view :style="{ width: star.activeWitch.replace('%','')*size/100+'px'}" class="uni-rate__icon-on"> <uni-icons style="text-align: left;" :color="disabled?'#ccc':activeColor" :size="size" type="star-filled" /> </view> <!-- #endif --> <!-- #ifndef APP-NVUE --> <view :style="{ width: star.activeWitch}" class="uni-rate__icon-on"> <uni-icons :color="disabled?disabledColor:activeColor" :size="size" type="star-filled" /> </view> <!-- #endif --> </view> </view> </view> </template> <script> // #ifdef APP-NVUE const dom = uni.requireNativePlugin('dom'); // #endif /** * Rate 评分 * @description 评分组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=33 * @property {Boolean} isFill = [true|false] 星星的类型,是否为实心类型, 默认为实心 * @property {String} color 未选中状态的星星颜色,默认为 "#ececec" * @property {String} activeColor 选中状态的星星颜色,默认为 "#ffca3e" * @property {String} disabledColor 禁用状态的星星颜色,默认为 "#c0c0c0" * @property {Number} size 星星的大小 * @property {Number} value/v-model 当前评分 * @property {Number} max 最大评分评分数量,目前一分一颗星 * @property {Number} margin 星星的间距,单位 px * @property {Boolean} disabled = [true|false] 是否为禁用状态,默认为 false * @property {Boolean} readonly = [true|false] 是否为只读状态,默认为 false * @property {Boolean} allowHalf = [true|false] 是否实现半星,默认为 false * @property {Boolean} touchable = [true|false] 是否支持滑动手势,默认为 true * @event {Function} change uniRate 的 value 改变时触发事件,e={value:Number} */ export default { name: "UniRate", props: { isFill: { // 星星的类型,是否镂空 type: [Boolean, String], default: true }, color: { // 星星未选中的颜色 type: String, default: "#ececec" }, activeColor: { // 星星选中状态颜色 type: String, default: "#ffca3e" }, disabledColor: { // 星星禁用状态颜色 type: String, default: "#c0c0c0" }, size: { // 星星的大小 type: [Number, String], default: 24 }, value: { // 当前评分 type: [Number, String], default: 0 }, modelValue: { // 当前评分 type: [Number, String], default: 0 }, max: { // 最大评分 type: [Number, String], default: 5 }, margin: { // 星星的间距 type: [Number, String], default: 0 }, disabled: { // 是否可点击 type: [Boolean, String], default: false }, readonly: { // 是否只读 type: [Boolean, String], default: false }, allowHalf: { // 是否显示半星 type: [Boolean, String], default: false }, touchable: { // 是否支持滑动手势 type: [Boolean, String], default: true } }, data() { return { valueSync: "", userMouseFristMove: true, userRated: false, userLastRate: 1 }; }, watch: { value(newVal) { this.valueSync = Number(newVal); }, modelValue(newVal) { this.valueSync = Number(newVal); }, }, computed: { stars() { const value = this.valueSync ? this.valueSync : 0; const starList = []; const floorValue = Math.floor(value); const ceilValue = Math.ceil(value); for (let i = 0; i < this.max; i++) { if (floorValue > i) { starList.push({ activeWitch: "100%" }); } else if (ceilValue - 1 === i) { starList.push({ activeWitch: (value - floorValue) * 100 + "%" }); } else { starList.push({ activeWitch: "0" }); } } return starList; }, marginNumber() { return Number(this.margin) } }, created() { this.valueSync = Number(this.value || this.modelValue); this._rateBoxLeft = 0 this._oldValue = null }, mounted() { setTimeout(() => { this._getSize() }, 100) // #ifdef H5 this.PC = this.IsPC() // #endif }, methods: { touchstart(e) { // #ifdef H5 if (this.IsPC()) return // #endif if (this.readonly || this.disabled) return const { clientX, screenX } = e.changedTouches[0] // TODO 做一下兼容,只有 Nvue 下才有 screenX,其他平台式 clientX this._getRateCount(clientX || screenX) }, touchmove(e) { // #ifdef H5 if (this.IsPC()) return // #endif if (this.readonly || this.disabled || !this.touchable) return const { clientX, screenX } = e.changedTouches[0] this._getRateCount(clientX || screenX) }, /** * 兼容 PC @tian */ mousedown(e) { // #ifdef H5 if (!this.IsPC()) return if (this.readonly || this.disabled) return const { clientX, } = e this.userLastRate = this.valueSync this._getRateCount(clientX) this.userRated = true // #endif }, mousemove(e) { // #ifdef H5 if (!this.IsPC()) return if (this.userRated) return if (this.userMouseFristMove) { console.log('---mousemove----', this.valueSync); this.userLastRate = this.valueSync this.userMouseFristMove = false } if (this.readonly || this.disabled || !this.touchable) return const { clientX, } = e this._getRateCount(clientX) // #endif }, mouseleave(e) { // #ifdef H5 if (!this.IsPC()) return if (this.readonly || this.disabled || !this.touchable) return if (this.userRated) { this.userRated = false return } this.valueSync = this.userLastRate // #endif }, // #ifdef H5 IsPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (let v = 0; v < Agents.length - 1; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; }, // #endif /** * 获取星星个数 */ _getRateCount(clientX) { this._getSize() const size = Number(this.size) if (isNaN(size)) { return new Error('size 属性只能设置为数字') } const rateMoveRange = clientX - this._rateBoxLeft let index = parseInt(rateMoveRange / (size + this.marginNumber)) index = index < 0 ? 0 : index; index = index > this.max ? this.max : index; const range = parseInt(rateMoveRange - (size + this.marginNumber) * index); let value = 0; if (this._oldValue === index && !this.PC) return; this._oldValue = index; if (this.allowHalf) { if (range > (size / 2)) { value = index + 1 } else { value = index + 0.5 } } else { value = index + 1 } value = Math.max(0.5, Math.min(value, this.max)) this.valueSync = value this._onChange() }, /** * 触发动态修改 */ _onChange() { this.$emit("input", this.valueSync); this.$emit("update:modelValue", this.valueSync); this.$emit("change", { value: this.valueSync }); }, /** * 获取星星距离屏幕左侧距离 */ _getSize() { // #ifndef APP-NVUE uni.createSelectorQuery() .in(this) .select('.uni-rate') .boundingClientRect() .exec(ret => { if (ret) { this._rateBoxLeft = ret[0].left } }) // #endif // #ifdef APP-NVUE dom.getComponentRect(this.$refs['uni-rate'], (ret) => { const size = ret.size if (size) { this._rateBoxLeft = size.left } }) // #endif } } }; </script> <style lang="scss"> .uni-rate { /* #ifndef APP-NVUE */ display: flex; /* #endif */ line-height: 1; font-size: 0; flex-direction: row; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-rate__icon { position: relative; line-height: 1; font-size: 0; } .uni-rate__icon-on { overflow: hidden; position: absolute; top: 0; left: 0; line-height: 1; text-align: left; } .uni-cursor-not-allowed { /* #ifdef H5 */ cursor: not-allowed !important; /* #endif */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-rate/components/uni-rate/uni-rate.vue
Vue
unknown
8,751
<template> <!-- #ifndef APP-NVUE --> <view :class="['uni-col', sizeClass, pointClassList]" :style="{ paddingLeft:`${Number(gutter)}rpx`, paddingRight:`${Number(gutter)}rpx`, }"> <slot></slot> </view> <!-- #endif --> <!-- #ifdef APP-NVUE --> <!-- 在nvue上,类名样式不生效,换为style --> <!-- 设置right正值失效,设置 left 负值 --> <view :class="['uni-col']" :style="{ paddingLeft:`${Number(gutter)}rpx`, paddingRight:`${Number(gutter)}rpx`, width:`${nvueWidth}rpx`, position:'relative', marginLeft:`${marginLeft}rpx`, left:`${right === 0 ? left : -right}rpx` }"> <slot></slot> </view> <!-- #endif --> </template> <script> /** * Col 布局-列 * @description 搭配uni-row使用,构建布局。 * @tutorial https://ext.dcloud.net.cn/plugin?id=3958 * * @property {span} type = Number 栅格占据的列数 * 默认 24 * @property {offset} type = Number 栅格左侧的间隔格数 * @property {push} type = Number 栅格向右移动格数 * @property {pull} type = Number 栅格向左移动格数 * @property {xs} type = [Number, Object] <768px 响应式栅格数或者栅格属性对象 * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4} * @property {sm} type = [Number, Object] ≥768px 响应式栅格数或者栅格属性对象 * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4} * @property {md} type = [Number, Object] ≥992px 响应式栅格数或者栅格属性对象 * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4} * @property {lg} type = [Number, Object] ≥1200px 响应式栅格数或者栅格属性对象 * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4} * @property {xl} type = [Number, Object] ≥1920px 响应式栅格数或者栅格属性对象 * @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4} */ const ComponentClass = 'uni-col'; // -1 默认值,因为在微信小程序端只给Number会有默认值0 export default { name: 'uniCol', // #ifdef MP-WEIXIN options: { virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现 }, // #endif props: { span: { type: Number, default: 24 }, offset: { type: Number, default: -1 }, pull: { type: Number, default: -1 }, push: { type: Number, default: -1 }, xs: [Number, Object], sm: [Number, Object], md: [Number, Object], lg: [Number, Object], xl: [Number, Object] }, data() { return { gutter: 0, sizeClass: '', parentWidth: 0, nvueWidth: 0, marginLeft: 0, right: 0, left: 0 } }, created() { // 字节小程序中,在computed中读取$parent为undefined let parent = this.$parent; while (parent && parent.$options.componentName !== 'uniRow') { parent = parent.$parent; } this.updateGutter(parent.gutter) parent.$watch('gutter', (gutter) => { this.updateGutter(gutter) }) // #ifdef APP-NVUE this.updateNvueWidth(parent.width) parent.$watch('width', (width) => { this.updateNvueWidth(width) }) // #endif }, computed: { sizeList() { let { span, offset, pull, push } = this; return { span, offset, pull, push } }, // #ifndef APP-NVUE pointClassList() { let classList = []; ['xs', 'sm', 'md', 'lg', 'xl'].forEach(point => { const props = this[point]; if (typeof props === 'number') { classList.push(`${ComponentClass}-${point}-${props}`) } else if (typeof props === 'object' && props) { Object.keys(props).forEach(pointProp => { classList.push( pointProp === 'span' ? `${ComponentClass}-${point}-${props[pointProp]}` : `${ComponentClass}-${point}-${pointProp}-${props[pointProp]}` ) }) } }); // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误 return classList.join(' '); } // #endif }, methods: { updateGutter(parentGutter) { parentGutter = Number(parentGutter); if (!isNaN(parentGutter)) { this.gutter = parentGutter / 2 } }, // #ifdef APP-NVUE updateNvueWidth(width) { // 用于在nvue端,span,offset,pull,push的计算 this.parentWidth = width; ['span', 'offset', 'pull', 'push'].forEach(size => { const curSize = this[size]; if ((curSize || curSize === 0) && curSize !== -1) { let RPX = 1 / 24 * curSize * width RPX = Number(RPX); switch (size) { case 'span': this.nvueWidth = RPX break; case 'offset': this.marginLeft = RPX break; case 'pull': this.right = RPX break; case 'push': this.left = RPX break; } } }); } // #endif }, watch: { sizeList: { immediate: true, handler(newVal) { // #ifndef APP-NVUE let classList = []; for (let size in newVal) { const curSize = newVal[size]; if ((curSize || curSize === 0) && curSize !== -1) { classList.push( size === 'span' ? `${ComponentClass}-${curSize}` : `${ComponentClass}-${size}-${curSize}` ) } } // 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误 this.sizeClass = classList.join(' '); // #endif // #ifdef APP-NVUE this.updateNvueWidth(this.parentWidth); // #endif } } } } </script> <style lang='scss' scoped> /* breakpoints */ $--sm: 768px !default; $--md: 992px !default; $--lg: 1200px !default; $--xl: 1920px !default; $breakpoints: ('xs' : (max-width: $--sm - 1), 'sm' : (min-width: $--sm), 'md' : (min-width: $--md), 'lg' : (min-width: $--lg), 'xl' : (min-width: $--xl)); $layout-namespace: ".uni-"; $col: $layout-namespace+"col"; @function getSize($size) { /* TODO 1/24 * $size * 100 * 1%; 使用计算后的值,为了解决 vue3 控制台报错 */ @return 0.04166666666 * $size * 100 * 1%; } @mixin res($key, $map:$breakpoints) { @if map-has-key($map, $key) { @media screen and #{inspect(map-get($map,$key))} { @content; } } @else { @warn "Undeinfed point: `#{$key}`"; } } /* #ifndef APP-NVUE */ #{$col} { float: left; box-sizing: border-box; } #{$col}-0 { /* #ifdef APP-NVUE */ width: 0; height: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; /* #endif */ /* #ifndef APP-NVUE */ display: none; /* #endif */ } @for $i from 0 through 24 { #{$col}-#{$i} { width: getSize($i); } #{$col}-offset-#{$i} { margin-left: getSize($i); } #{$col}-pull-#{$i} { position: relative; right: getSize($i); } #{$col}-push-#{$i} { position: relative; left: getSize($i); } } @each $point in map-keys($breakpoints) { @include res($point) { #{$col}-#{$point}-0 { display: none; } @for $i from 0 through 24 { #{$col}-#{$point}-#{$i} { width: getSize($i); } #{$col}-#{$point}-offset-#{$i} { margin-left: getSize($i); } #{$col}-#{$point}-pull-#{$i} { position: relative; right: getSize($i); } #{$col}-#{$point}-push-#{$i} { position: relative; left: getSize($i); } } } } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-row/components/uni-col/uni-col.vue
Vue
unknown
7,711
<template> <view :class="[ 'uni-row', typeClass , justifyClass, alignClass, ]" :style="{ marginLeft:`${Number(marginValue)}rpx`, marginRight:`${Number(marginValue)}rpx`, }"> <slot></slot> </view> </template> <script> const ComponentClass = 'uni-row'; const modifierSeparator = '--'; /** * Row 布局-行 * @description 流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。 * @tutorial https://ext.dcloud.net.cn/plugin?id=3958 * * @property {gutter} type = Number 栅格间隔 * @property {justify} type = String flex 布局下的水平排列方式 * 可选 start/end/center/space-around/space-between start * 默认值 start * @property {align} type = String flex 布局下的垂直排列方式 * 可选 top/middle/bottom * 默认值 top * @property {width} type = String|Number nvue下需要自行配置宽度用于计算 * 默认值 750 */ export default { name: 'uniRow', componentName: 'uniRow', // #ifdef MP-WEIXIN options: { virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现,可使用flex布局 }, // #endif props: { type: String, gutter: Number, justify: { type: String, default: 'start' }, align: { type: String, default: 'top' }, // nvue如果使用span等属性,需要配置宽度 width: { type: [String, Number], default: 750 } }, created() { // #ifdef APP-NVUE this.type = 'flex'; // #endif }, computed: { marginValue() { // #ifndef APP-NVUE if (this.gutter) { return -(this.gutter / 2); } // #endif return 0; }, typeClass() { return this.type === 'flex' ? `${ComponentClass + modifierSeparator}flex` : ''; }, justifyClass() { return this.justify !== 'start' ? `${ComponentClass + modifierSeparator}flex-justify-${this.justify}` : '' }, alignClass() { return this.align !== 'top' ? `${ComponentClass + modifierSeparator}flex-align-${this.align}` : '' } } }; </script> <style lang="scss"> $layout-namespace: ".uni-"; $row:$layout-namespace+"row"; $modifier-separator: "--"; @mixin utils-clearfix { $selector: &; @at-root { /* #ifndef APP-NVUE */ #{$selector}::before, #{$selector}::after { display: table; content: ""; } #{$selector}::after { clear: both; } /* #endif */ } } @mixin utils-flex ($direction: row) { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: $direction; } @mixin set-flex($state) { @at-root &-#{$state} { @content } } #{$row} { position: relative; flex-direction: row; /* #ifdef APP-NVUE */ flex: 1; /* #endif */ /* #ifndef APP-NVUE */ box-sizing: border-box; /* #endif */ // 非nvue使用float布局 @include utils-clearfix; // 在QQ、字节、百度小程序平台,编译后使用shadow dom,不可使用flex布局,使用float @at-root { /* #ifndef MP-QQ || MP-TOUTIAO || MP-BAIDU */ &#{$modifier-separator}flex { @include utils-flex; flex-wrap: wrap; flex: 1; &:before, &:after { /* #ifndef APP-NVUE */ display: none; /* #endif */ } @include set-flex(justify-center) { justify-content: center; } @include set-flex(justify-end) { justify-content: flex-end; } @include set-flex(justify-space-between) { justify-content: space-between; } @include set-flex(justify-space-around) { justify-content: space-around; } @include set-flex(align-middle) { align-items: center; } @include set-flex(align-bottom) { align-items: flex-end; } } /* #endif */ } } // 字节、QQ配置后不生效 // 此处用法无法使用scoped /* #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ */ :host { display: block; } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-row/components/uni-row/uni-row.vue
Vue
unknown
3,948
@import './styles/index.scss';
2301_77169380/AppruanjianApk
uni_modules/uni-scss/index.scss
SCSS
unknown
31
@import './setting/_variables.scss'; @import './setting/_border.scss'; @import './setting/_color.scss'; @import './setting/_space.scss'; @import './setting/_radius.scss'; @import './setting/_text.scss'; @import './setting/_styles.scss';
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/index.scss
SCSS
unknown
237
.uni-border { border: 1px $uni-border-1 solid; }
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_border.scss
SCSS
unknown
49
// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 // @mixin get-styles($k,$c) { // @if $k == size or $k == weight{ // font-#{$k}:#{$c} // }@else{ // #{$k}:#{$c} // } // } $uni-ui-color:( // 主色 primary: $uni-primary, primary-disable: $uni-primary-disable, primary-light: $uni-primary-light, // 辅助色 success: $uni-success, success-disable: $uni-success-disable, success-light: $uni-success-light, warning: $uni-warning, warning-disable: $uni-warning-disable, warning-light: $uni-warning-light, error: $uni-error, error-disable: $uni-error-disable, error-light: $uni-error-light, info: $uni-info, info-disable: $uni-info-disable, info-light: $uni-info-light, // 中性色 main-color: $uni-main-color, base-color: $uni-base-color, secondary-color: $uni-secondary-color, extra-color: $uni-extra-color, // 背景色 bg-color: $uni-bg-color, // 边框颜色 border-1: $uni-border-1, border-2: $uni-border-2, border-3: $uni-border-3, border-4: $uni-border-4, // 黑色 black:$uni-black, // 白色 white:$uni-white, // 透明 transparent:$uni-transparent ) !default; @each $key, $child in $uni-ui-color { .uni-#{"" + $key} { color: $child; } .uni-#{"" + $key}-bg { background-color: $child; } } .uni-shadow-sm { box-shadow: $uni-shadow-sm; } .uni-shadow-base { box-shadow: $uni-shadow-base; } .uni-shadow-lg { box-shadow: $uni-shadow-lg; } .uni-mask { background-color:$uni-mask; }
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_color.scss
SCSS
unknown
1,491
@mixin radius($r,$d:null ,$important: false){ $radius-value:map-get($uni-radius, $r) if($important, !important, null); // Key exists within the $uni-radius variable @if (map-has-key($uni-radius, $r) and $d){ @if $d == t { border-top-left-radius:$radius-value; border-top-right-radius:$radius-value; }@else if $d == r { border-top-right-radius:$radius-value; border-bottom-right-radius:$radius-value; }@else if $d == b { border-bottom-left-radius:$radius-value; border-bottom-right-radius:$radius-value; }@else if $d == l { border-top-left-radius:$radius-value; border-bottom-left-radius:$radius-value; }@else if $d == tl { border-top-left-radius:$radius-value; }@else if $d == tr { border-top-right-radius:$radius-value; }@else if $d == br { border-bottom-right-radius:$radius-value; }@else if $d == bl { border-bottom-left-radius:$radius-value; } }@else{ border-radius:$radius-value; } } @each $key, $child in $uni-radius { @if($key){ .uni-radius-#{"" + $key} { @include radius($key) } }@else{ .uni-radius { @include radius($key) } } } @each $direction in t, r, b, l,tl, tr, br, bl { @each $key, $child in $uni-radius { @if($key){ .uni-radius-#{"" + $direction}-#{"" + $key} { @include radius($key,$direction,false) } }@else{ .uni-radius-#{$direction} { @include radius($key,$direction,false) } } } }
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_radius.scss
SCSS
unknown
1,430
@mixin fn($space,$direction,$size,$n) { @if $n { #{$space}-#{$direction}: #{$size*$uni-space-root}px } @else { #{$space}-#{$direction}: #{-$size*$uni-space-root}px } } @mixin get-styles($direction,$i,$space,$n){ @if $direction == t { @include fn($space, top,$i,$n); } @if $direction == r { @include fn($space, right,$i,$n); } @if $direction == b { @include fn($space, bottom,$i,$n); } @if $direction == l { @include fn($space, left,$i,$n); } @if $direction == x { @include fn($space, left,$i,$n); @include fn($space, right,$i,$n); } @if $direction == y { @include fn($space, top,$i,$n); @include fn($space, bottom,$i,$n); } @if $direction == a { @if $n { #{$space}:#{$i*$uni-space-root}px; } @else { #{$space}:#{-$i*$uni-space-root}px; } } } @each $orientation in m,p { $space: margin; @if $orientation == m { $space: margin; } @else { $space: padding; } @for $i from 0 through 16 { @each $direction in t, r, b, l, x, y, a { .uni-#{$orientation}#{$direction}-#{$i} { @include get-styles($direction,$i,$space,true); } .uni-#{$orientation}#{$direction}-n#{$i} { @include get-styles($direction,$i,$space,false); } } } }
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_space.scss
SCSS
unknown
1,214
/* #ifndef APP-NVUE */ $-color-white:#fff; $-color-black:#000; @mixin base-style($color) { color: #fff; background-color: $color; border-color: mix($-color-black, $color, 8%); &:not([hover-class]):active { background: mix($-color-black, $color, 10%); border-color: mix($-color-black, $color, 20%); color: $-color-white; outline: none; } } @mixin is-color($color) { @include base-style($color); &[loading] { @include base-style($color); &::before { margin-right:5px; } } &[disabled] { &, &[loading], &:not([hover-class]):active { color: $-color-white; border-color: mix(darken($color,10%), $-color-white); background-color: mix($color, $-color-white); } } } @mixin base-plain-style($color) { color:$color; background-color: mix($-color-white, $color, 90%); border-color: mix($-color-white, $color, 70%); &:not([hover-class]):active { background: mix($-color-white, $color, 80%); color: $color; outline: none; border-color: mix($-color-white, $color, 50%); } } @mixin is-plain($color){ &[plain] { @include base-plain-style($color); &[loading] { @include base-plain-style($color); &::before { margin-right:5px; } } &[disabled] { &, &:active { color: mix($-color-white, $color, 40%); background-color: mix($-color-white, $color, 90%); border-color: mix($-color-white, $color, 80%); } } } } .uni-btn { margin: 5px; color: #393939; border:1px solid #ccc; font-size: 16px; font-weight: 200; background-color: #F9F9F9; // TODO 暂时处理边框隐藏一边的问题 overflow: visible; &::after{ border: none; } &:not([type]),&[type=default] { color: #999; &[loading] { background: none; &::before { margin-right:5px; } } &[disabled]{ color: mix($-color-white, #999, 60%); &, &[loading], &:active { color: mix($-color-white, #999, 60%); background-color: mix($-color-white,$-color-black , 98%); border-color: mix($-color-white, #999, 85%); } } &[plain] { color: #999; background: none; border-color: $uni-border-1; &:not([hover-class]):active { background: none; color: mix($-color-white, $-color-black, 80%); border-color: mix($-color-white, $-color-black, 90%); outline: none; } &[disabled]{ &, &[loading], &:active { background: none; color: mix($-color-white, #999, 60%); border-color: mix($-color-white, #999, 85%); } } } } &:not([hover-class]):active { color: mix($-color-white, $-color-black, 50%); } &[size=mini] { font-size: 16px; font-weight: 200; border-radius: 8px; } &.uni-btn-small { font-size: 14px; } &.uni-btn-mini { font-size: 12px; } &.uni-btn-radius { border-radius: 999px; } &[type=primary] { @include is-color($uni-primary); @include is-plain($uni-primary) } &[type=success] { @include is-color($uni-success); @include is-plain($uni-success) } &[type=error] { @include is-color($uni-error); @include is-plain($uni-error) } &[type=warning] { @include is-color($uni-warning); @include is-plain($uni-warning) } &[type=info] { @include is-color($uni-info); @include is-plain($uni-info) } } /* #endif */
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_styles.scss
SCSS
unknown
3,253
@mixin get-styles($k,$c) { @if $k == size or $k == weight{ font-#{$k}:#{$c} }@else{ #{$k}:#{$c} } } @each $key, $child in $uni-headings { /* #ifndef APP-NVUE */ .uni-#{$key} { @each $k, $c in $child { @include get-styles($k,$c) } } /* #endif */ /* #ifdef APP-NVUE */ .container .uni-#{$key} { @each $k, $c in $child { @include get-styles($k,$c) } } /* #endif */ }
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_text.scss
SCSS
unknown
394
// @use "sass:math"; @import '../tools/functions.scss'; // 间距基础倍数 $uni-space-root: 2 !default; // 边框半径默认值 $uni-radius-root:5px !default; $uni-radius: () !default; // 边框半径断点 $uni-radius: map-deep-merge( ( 0: 0, // TODO 当前版本暂时不支持 sm 属性 // 'sm': math.div($uni-radius-root, 2), null: $uni-radius-root, 'lg': $uni-radius-root * 2, 'xl': $uni-radius-root * 6, 'pill': 9999px, 'circle': 50% ), $uni-radius ); // 字体家族 $body-font-family: 'Roboto', sans-serif !default; // 文本 $heading-font-family: $body-font-family !default; $uni-headings: () !default; $letterSpacing: -0.01562em; $uni-headings: map-deep-merge( ( 'h1': ( size: 32px, weight: 300, line-height: 50px, // letter-spacing:-0.01562em ), 'h2': ( size: 28px, weight: 300, line-height: 40px, // letter-spacing: -0.00833em ), 'h3': ( size: 24px, weight: 400, line-height: 32px, // letter-spacing: normal ), 'h4': ( size: 20px, weight: 400, line-height: 30px, // letter-spacing: 0.00735em ), 'h5': ( size: 16px, weight: 400, line-height: 24px, // letter-spacing: normal ), 'h6': ( size: 14px, weight: 500, line-height: 18px, // letter-spacing: 0.0125em ), 'subtitle': ( size: 12px, weight: 400, line-height: 20px, // letter-spacing: 0.00937em ), 'body': ( font-size: 14px, font-weight: 400, line-height: 22px, // letter-spacing: 0.03125em ), 'caption': ( 'size': 12px, 'weight': 400, 'line-height': 20px, // 'letter-spacing': 0.03333em, // 'text-transform': false ) ), $uni-headings ); // 主色 $uni-primary: #2979ff !default; $uni-primary-disable:lighten($uni-primary,20%) !default; $uni-primary-light: lighten($uni-primary,25%) !default; // 辅助色 // 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 $uni-success: #18bc37 !default; $uni-success-disable:lighten($uni-success,20%) !default; $uni-success-light: lighten($uni-success,25%) !default; $uni-warning: #f3a73f !default; $uni-warning-disable:lighten($uni-warning,20%) !default; $uni-warning-light: lighten($uni-warning,25%) !default; $uni-error: #e43d33 !default; $uni-error-disable:lighten($uni-error,20%) !default; $uni-error-light: lighten($uni-error,25%) !default; $uni-info: #8f939c !default; $uni-info-disable:lighten($uni-info,20%) !default; $uni-info-light: lighten($uni-info,25%) !default; // 中性色 // 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 $uni-main-color: #3a3a3a !default; // 主要文字 $uni-base-color: #6a6a6a !default; // 常规文字 $uni-secondary-color: #909399 !default; // 次要文字 $uni-extra-color: #c7c7c7 !default; // 辅助说明 // 边框颜色 $uni-border-1: #F0F0F0 !default; $uni-border-2: #EDEDED !default; $uni-border-3: #DCDCDC !default; $uni-border-4: #B9B9B9 !default; // 常规色 $uni-black: #000000 !default; $uni-white: #ffffff !default; $uni-transparent: rgba($color: #000000, $alpha: 0) !default; // 背景色 $uni-bg-color: #f7f7f7 !default; /* 水平间距 */ $uni-spacing-sm: 8px !default; $uni-spacing-base: 15px !default; $uni-spacing-lg: 30px !default; // 阴影 $uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; $uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; $uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; // 蒙版 $uni-mask: rgba($color: #000000, $alpha: 0.4) !default;
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/setting/_variables.scss
SCSS
unknown
3,753
// 合并 map @function map-deep-merge($parent-map, $child-map){ $result: $parent-map; @each $key, $child in $child-map { $parent-has-key: map-has-key($result, $key); $parent-value: map-get($result, $key); $parent-type: type-of($parent-value); $child-type: type-of($child); $parent-is-map: $parent-type == map; $child-is-map: $child-type == map; @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ $result: map-merge($result, ( $key: $child )); }@else { $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); } } @return $result; };
2301_77169380/AppruanjianApk
uni_modules/uni-scss/styles/tools/functions.scss
SCSS
unknown
640
// 间距基础倍数 $uni-space-root: 2; // 边框半径默认值 $uni-radius-root:5px; // 主色 $uni-primary: #2979ff; // 辅助色 $uni-success: #4cd964; // 警告色 $uni-warning: #f0ad4e; // 错误色 $uni-error: #dd524d; // 描述色 $uni-info: #909399; // 中性色 $uni-main-color: #303133; $uni-base-color: #606266; $uni-secondary-color: #909399; $uni-extra-color: #C0C4CC; // 背景色 $uni-bg-color: #f5f5f5; // 边框颜色 $uni-border-1: #DCDFE6; $uni-border-2: #E4E7ED; $uni-border-3: #EBEEF5; $uni-border-4: #F2F6FC; // 常规色 $uni-black: #000000; $uni-white: #ffffff; $uni-transparent: rgba($color: #000000, $alpha: 0);
2301_77169380/AppruanjianApk
uni_modules/uni-scss/theme.scss
SCSS
unknown
641
@import './styles/setting/_variables.scss'; // 间距基础倍数 $uni-space-root: 2; // 边框半径默认值 $uni-radius-root:5px; // 主色 $uni-primary: #2979ff; $uni-primary-disable:mix(#fff,$uni-primary,50%); $uni-primary-light: mix(#fff,$uni-primary,80%); // 辅助色 // 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 $uni-success: #18bc37; $uni-success-disable:mix(#fff,$uni-success,50%); $uni-success-light: mix(#fff,$uni-success,80%); $uni-warning: #f3a73f; $uni-warning-disable:mix(#fff,$uni-warning,50%); $uni-warning-light: mix(#fff,$uni-warning,80%); $uni-error: #e43d33; $uni-error-disable:mix(#fff,$uni-error,50%); $uni-error-light: mix(#fff,$uni-error,80%); $uni-info: #8f939c; $uni-info-disable:mix(#fff,$uni-info,50%); $uni-info-light: mix(#fff,$uni-info,80%); // 中性色 // 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 $uni-main-color: #3a3a3a; // 主要文字 $uni-base-color: #6a6a6a; // 常规文字 $uni-secondary-color: #909399; // 次要文字 $uni-extra-color: #c7c7c7; // 辅助说明 // 边框颜色 $uni-border-1: #F0F0F0; $uni-border-2: #EDEDED; $uni-border-3: #DCDCDC; $uni-border-4: #B9B9B9; // 常规色 $uni-black: #000000; $uni-white: #ffffff; $uni-transparent: rgba($color: #000000, $alpha: 0); // 背景色 $uni-bg-color: #f7f7f7; /* 水平间距 */ $uni-spacing-sm: 8px; $uni-spacing-base: 15px; $uni-spacing-lg: 30px; // 阴影 $uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); $uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); $uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); // 蒙版 $uni-mask: rgba($color: #000000, $alpha: 0.4);
2301_77169380/AppruanjianApk
uni_modules/uni-scss/variables.scss
SCSS
unknown
1,764
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js
JavaScript
unknown
162
<template> <view class="uni-searchbar"> <view :style="{borderRadius:radius+'px',backgroundColor: bgColor}" class="uni-searchbar__box" @click="searchClick"> <view class="uni-searchbar__box-icon-search"> <slot name="searchIcon"> <uni-icons color="#c0c4cc" size="18" type="search" /> </slot> </view> <input v-if="show || searchVal" :focus="showSync" :disabled="readonly" :placeholder="placeholderText" :maxlength="maxlength" class="uni-searchbar__box-search-input" confirm-type="search" type="text" v-model="searchVal" :style="{color:textColor}" @confirm="confirm" @blur="blur" @focus="emitFocus"/> <text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text> <view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='') &&!readonly" class="uni-searchbar__box-icon-clear" @click="clear"> <slot name="clearIcon"> <uni-icons color="#c0c4cc" size="20" type="clear" /> </slot> </view> </view> <text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelTextI18n}}</text> </view> </template> <script> import { initVueI18n } from '@dcloudio/uni-i18n' import messages from './i18n/index.js' const { t } = initVueI18n(messages) /** * SearchBar 搜索栏 * @description 搜索栏组件,通常用于搜索商品、文章等 * @tutorial https://ext.dcloud.net.cn/plugin?id=866 * @property {Number} radius 搜索栏圆角 * @property {Number} maxlength 输入最大长度 * @property {String} placeholder 搜索栏Placeholder * @property {String} clearButton = [always|auto|none] 是否显示清除按钮 * @value always 一直显示 * @value auto 输入框不为空时显示 * @value none 一直不显示 * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮 * @value always 一直显示 * @value auto 输入框不为空时显示 * @value none 一直不显示 * @property {String} cancelText 取消按钮的文字 * @property {String} bgColor 输入框背景颜色 * @property {String} textColor 输入文字颜色 * @property {Boolean} focus 是否自动聚焦 * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示 * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number} * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number} */ export default { name: "UniSearchBar", emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'], props: { placeholder: { type: String, default: "" }, radius: { type: [Number, String], default: 5 }, clearButton: { type: String, default: "auto" }, cancelButton: { type: String, default: "auto" }, cancelText: { type: String, default: "" }, bgColor: { type: String, default: "#F8F8F8" }, textColor: { type: String, default: "#000000" }, maxlength: { type: [Number, String], default: 100 }, value: { type: [Number, String], default: "" }, modelValue: { type: [Number, String], default: "" }, focus: { type: Boolean, default: false }, readonly: { type: Boolean, default: false } }, data() { return { show: false, showSync: false, searchVal: '' } }, computed: { cancelTextI18n() { return this.cancelText || t("uni-search-bar.cancel") }, placeholderText() { return this.placeholder || t("uni-search-bar.placeholder") } }, watch: { // #ifndef VUE3 value: { immediate: true, handler(newVal) { this.searchVal = newVal if (newVal) { this.show = true } } }, // #endif // #ifdef VUE3 modelValue: { immediate: true, handler(newVal) { this.searchVal = newVal if (newVal) { this.show = true } } }, // #endif focus: { immediate: true, handler(newVal) { if (newVal) { if(this.readonly) return this.show = true; this.$nextTick(() => { this.showSync = true }) } } }, searchVal(newVal, oldVal) { this.$emit("input", newVal) // #ifdef VUE3 this.$emit("update:modelValue", newVal) // #endif } }, methods: { searchClick() { if(this.readonly) return if (this.show) { return } this.show = true; this.$nextTick(() => { this.showSync = true }) }, clear() { this.searchVal = "" this.$nextTick(() => { this.$emit("clear", { value: "" }) }) }, cancel() { if(this.readonly) return this.$emit("cancel", { value: this.searchVal }); this.searchVal = "" this.show = false this.showSync = false // #ifndef APP-PLUS uni.hideKeyboard() // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif }, confirm() { // #ifndef APP-PLUS uni.hideKeyboard(); // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif this.$emit("confirm", { value: this.searchVal }) }, blur() { // #ifndef APP-PLUS uni.hideKeyboard(); // #endif // #ifdef APP-PLUS plus.key.hideSoftKeybord() // #endif this.$emit("blur", { value: this.searchVal }) }, emitFocus(e) { this.$emit("focus", e.detail) } } }; </script> <style lang="scss"> $uni-searchbar-height: 36px; .uni-searchbar { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; position: relative; padding: 10px; // background-color: #fff; } .uni-searchbar__box { /* #ifndef APP-NVUE */ display: flex; box-sizing: border-box; justify-content: left; /* #endif */ overflow: hidden; position: relative; flex: 1; flex-direction: row; align-items: center; height: $uni-searchbar-height; padding: 5px 8px 5px 0px; } .uni-searchbar__box-icon-search { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; // width: 32px; padding: 0 8px; justify-content: center; align-items: center; color: #B3B3B3; } .uni-searchbar__box-search-input { flex: 1; font-size: 14px; color: #333; margin-left: 5px; margin-top: 1px; /* #ifndef APP-NVUE */ background-color: inherit; /* #endif */ } .uni-searchbar__box-icon-clear { align-items: center; line-height: 24px; padding-left: 8px; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .uni-searchbar__text-placeholder { font-size: 14px; color: #B3B3B3; margin-left: 5px; text-align: left; } .uni-searchbar__cancel { padding-left: 10px; line-height: $uni-searchbar-height; font-size: 14px; color: #333333; /* #ifdef H5 */ cursor: pointer; /* #endif */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue
Vue
unknown
7,304
<template> <view class="uni-section"> <view class="uni-section-header" @click="onClick"> <view class="uni-section-header__decoration" v-if="type" :class="type" /> <slot v-else name="decoration"></slot> <view class="uni-section-header__content"> <text :style="{'font-size':titleFontSize,'color':titleColor}" class="uni-section__content-title" :class="{'distraction':!subTitle}">{{ title }}</text> <text v-if="subTitle" :style="{'font-size':subTitleFontSize,'color':subTitleColor}" class="uni-section-header__content-sub">{{ subTitle }}</text> </view> <view class="uni-section-header__slot-right"> <slot name="right"></slot> </view> </view> <view class="uni-section-content" :style="{padding: _padding}"> <slot /> </view> </view> </template> <script> /** * Section 标题栏 * @description 标题栏 * @property {String} type = [line|circle|square] 标题装饰类型 * @value line 竖线 * @value circle 圆形 * @value square 正方形 * @property {String} title 主标题 * @property {String} titleFontSize 主标题字体大小 * @property {String} titleColor 主标题字体颜色 * @property {String} subTitle 副标题 * @property {String} subTitleFontSize 副标题字体大小 * @property {String} subTitleColor 副标题字体颜色 * @property {String} padding 默认插槽 padding */ export default { name: 'UniSection', emits:['click'], props: { type: { type: String, default: '' }, title: { type: String, required: true, default: '' }, titleFontSize: { type: String, default: '14px' }, titleColor:{ type: String, default: '#333' }, subTitle: { type: String, default: '' }, subTitleFontSize: { type: String, default: '12px' }, subTitleColor: { type: String, default: '#999' }, padding: { type: [Boolean, String], default: false } }, computed:{ _padding(){ if(typeof this.padding === 'string'){ return this.padding } return this.padding?'10px':'' } }, watch: { title(newVal) { if (uni.report && newVal !== '') { uni.report('title', newVal) } } }, methods: { onClick() { this.$emit('click') } } } </script> <style lang="scss" > $uni-primary: #2979ff !default; .uni-section { background-color: #fff; .uni-section-header { position: relative; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: center; padding: 12px 10px; font-weight: normal; &__decoration{ margin-right: 6px; background-color: $uni-primary; &.line { width: 4px; height: 12px; border-radius: 10px; } &.circle { width: 8px; height: 8px; border-top-right-radius: 50px; border-top-left-radius: 50px; border-bottom-left-radius: 50px; border-bottom-right-radius: 50px; } &.square { width: 8px; height: 8px; } } &__content { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; flex: 1; color: #333; .distraction { flex-direction: row; align-items: center; } &-sub { margin-top: 2px; } } &__slot-right{ font-size: 14px; } } .uni-section-content{ font-size: 14px; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-section/components/uni-section/uni-section.vue
Vue
unknown
3,700
<template> <view :class="[styleType === 'text'?'segmented-control--text' : 'segmented-control--button' ]" :style="{ borderColor: styleType === 'text' ? '' : activeColor }" class="segmented-control"> <view v-for="(item, index) in values" :class="[styleType === 'text' ? '' : 'segmented-control__item--button', index === 0 && styleType === 'button' ? 'segmented-control__item--button--first' : '', index === values.length - 1 && styleType === 'button' ? 'segmented-control__item--button--last':'']" :key="index" :style="{backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : styleType === 'button' ?inActiveColor:'transparent', borderColor: index === currentIndex && styleType === 'text' || styleType === 'button' ? activeColor : inActiveColor}" class="segmented-control__item" @click="_onClick(index)"> <view> <text :style="{color:index === currentIndex? styleType === 'text'? activeColor: '#fff': styleType === 'text'? '#000': activeColor}" class="segmented-control__text" :class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text': ''">{{ item }}</text> </view> </view> </view> </template> <script> /** * SegmentedControl 分段器 * @description 用作不同视图的显示 * @tutorial https://ext.dcloud.net.cn/plugin?id=54 * @property {Number} current 当前选中的tab索引值,从0计数 * @property {String} styleType = [button|text] 分段器样式类型 * @value button 按钮类型 * @value text 文字类型 * @property {String} activeColor 选中的标签背景色与边框颜色 * @property {String} inActiveColor 未选中的标签背景色与边框颜色 * @property {Array} values 选项数组 * @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex} */ export default { name: 'UniSegmentedControl', emits: ['clickItem'], props: { current: { type: Number, default: 0 }, values: { type: Array, default () { return [] } }, activeColor: { type: String, default: '#2979FF' }, inActiveColor: { type: String, default: 'transparent' }, styleType: { type: String, default: 'button' } }, data() { return { currentIndex: 0 } }, watch: { current(val) { if (val !== this.currentIndex) { this.currentIndex = val } } }, computed: {}, created() { this.currentIndex = this.current }, methods: { _onClick(index) { if (this.currentIndex !== index) { this.currentIndex = index this.$emit('clickItem', { currentIndex: index }) } } } } </script> <style lang="scss" scoped> .segmented-control { /* #ifndef APP-NVUE */ display: flex; box-sizing: border-box; /* #endif */ flex-direction: row; height: 36px; overflow: hidden; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .segmented-control__item { /* #ifndef APP-NVUE */ display: inline-flex; box-sizing: border-box; /* #endif */ position: relative; flex: 1; justify-content: center; align-items: center; } .segmented-control__item--button { border-style: solid; border-top-width: 1px; border-bottom-width: 1px; border-right-width: 1px; border-left-width: 0; } .segmented-control__item--button--first { border-left-width: 1px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; } .segmented-control__item--button--last { border-top-right-radius: 5px; border-bottom-right-radius: 5px; } .segmented-control__item--text { border-bottom-style: solid; border-bottom-width: 2px; padding: 6px 0; } .segmented-control__text { font-size: 14px; line-height: 20px; text-align: center; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue
Vue
unknown
3,768
<template> <view class="uni-steps"> <view :class="[direction==='column'?'uni-steps__column':'uni-steps__row']"> <view :class="[direction==='column'?'uni-steps__column-text-container':'uni-steps__row-text-container']"> <view v-for="(item,index) in options" :key="index" :class="[direction==='column'?'uni-steps__column-text':'uni-steps__row-text']"> <text :style="{color:index === active?activeColor:deactiveColor}" :class="[direction==='column'?'uni-steps__column-title':'uni-steps__row-title']">{{item.title}}</text> <text :style="{color: deactiveColor}" :class="[direction==='column'?'uni-steps__column-desc':'uni-steps__row-desc']">{{item.desc}}</text> </view> </view> <view :class="[direction==='column'?'uni-steps__column-container':'uni-steps__row-container']"> <view :class="[direction==='column'?'uni-steps__column-line-item':'uni-steps__row-line-item']" v-for="(item,index) in options" :key="index" :style="{height: direction === 'column'?heightArr[index]+'px':'14px'}"> <view :class="[direction==='column'?'uni-steps__column-line':'uni-steps__row-line',direction==='column'?'uni-steps__column-line--before':'uni-steps__row-line--before']" :style="{backgroundColor:index<=active&&index!==0?activeColor:index===0?'transparent':deactiveColor}"> </view> <view :class="[direction==='column'?'uni-steps__column-check':'uni-steps__row-check']" v-if="index === active"> <uni-icons :color="activeColor" :type="activeIcon" size="14" /> </view> <view v-else :class="[direction==='column'?'uni-steps__column-circle':'uni-steps__row-circle']" :style="{backgroundColor:index<active?activeColor:deactiveColor}" /> <view :class="[direction==='column'?'uni-steps__column-line':'uni-steps__row-line',direction==='column'?'uni-steps__column-line--after':'uni-steps__row-line--after']" :style="{backgroundColor:index<active&&index!==options.length-1?activeColor:index===options.length-1?'transparent':deactiveColor}" /> </view> </view> </view> </view> </template> <script> /** * Steps 步骤条 * @description 评分组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=34 * @property {Number} active 当前步骤 * @property {String} direction = [row|column] 当前步骤 * @value row 横向 * @value column 纵向 * @property {String} activeColor 选中状态的颜色 * @property {Array} options 数据源,格式为:[{title:'xxx',desc:'xxx'},{title:'xxx',desc:'xxx'}] */ export default { name: 'UniSteps', props: { direction: { // 排列方向 row column type: String, default: 'row' }, activeColor: { // 激活状态颜色 type: String, default: '#2979FF' }, deactiveColor: { // 未激活状态颜色 type: String, default: '#B7BDC6' }, active: { // 当前步骤 type: Number, default: 0 }, activeIcon: { // 当前步骤 type: String, default: 'checkbox-filled' }, options: { type: Array, default () { return [] } } // 数据 }, data() { return { heightArr: [], } }, mounted() { //根据内容设置步骤条的长度 if (this.direction === 'column') { let that = this; //只能用类选择器,用id选择器所获取的元素信息不准确 uni.createSelectorQuery().in(this).selectAll('.uni-steps__column-text').boundingClientRect(data => { that.heightArr = data.map(item => item.height + 1); }).exec() } }, } </script> <style lang="scss"> $uni-primary: #2979ff !default; $uni-border-color: #EDEDED; .uni-steps { /* #ifndef APP-NVUE */ display: flex; width: 100%; /* #endif */ /* #ifdef APP-NVUE */ flex: 1; /* #endif */ flex-direction: column; } .uni-steps__row { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; } .uni-steps__column { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row-reverse; } .uni-steps__row-text-container { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; align-items: flex-end; margin-bottom: 8px; } .uni-steps__column-text-container { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; flex: 1; } .uni-steps__row-text { /* #ifndef APP-NVUE */ display: inline-flex; /* #endif */ flex: 1; flex-direction: column; } .uni-steps__column-text { padding: 6px 0px; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: $uni-border-color; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; } .uni-steps__row-title { font-size: 14px; line-height: 16px; text-align: center; } .uni-steps__column-title { font-size: 14px; text-align: left; line-height: 18px; } .uni-steps__row-desc { font-size: 12px; line-height: 14px; text-align: center; } .uni-steps__column-desc { font-size: 12px; text-align: left; line-height: 18px; } .uni-steps__row-container { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .uni-steps__column-container { /* #ifndef APP-NVUE */ display: inline-flex; /* #endif */ width: 30px; flex-direction: column; } .uni-steps__row-line-item { /* #ifndef APP-NVUE */ display: inline-flex; /* #endif */ flex-direction: row; flex: 1; height: 14px; line-height: 14px; align-items: center; justify-content: center; } .uni-steps__column-line-item { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; align-items: center; justify-content: center; } .uni-steps__row-line { flex: 1; height: 1px; background-color: #B7BDC6; } .uni-steps__column-line { width: 1px; background-color: #B7BDC6; } .uni-steps__row-line--after { transform: translateX(1px); } .uni-steps__column-line--after { flex: 1; transform: translate(0px, 1px); } .uni-steps__row-line--before { transform: translateX(-1px); } .uni-steps__column-line--before { height: 6px; transform: translate(0px, -13px); } .uni-steps__row-circle { width: 5px; height: 5px; border-radius: 50%; background-color: #B7BDC6; margin: 0px 3px; } .uni-steps__column-circle { width: 5px; height: 5px; border-radius: 50%; background-color: #B7BDC6; margin: 4px 0px 5px 0px; } .uni-steps__row-check { margin: 0px 6px; } .uni-steps__column-check { height: 14px; line-height: 14px; margin: 2px 0px; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-steps/components/uni-steps/uni-steps.vue
Vue
unknown
6,568
<template> <view> <slot></slot> </view> </template> <script> /** * SwipeAction 滑动操作 * @description 通过滑动触发选项的容器 * @tutorial https://ext.dcloud.net.cn/plugin?id=181 */ export default { name:"uniSwipeAction", data() { return {}; }, created() { this.children = []; }, methods: { // 公开给用户使用,重制组件样式 resize(){ // wxs 会自己计算组件大小,所以无需执行下面代码 // #ifndef APP-VUE || H5 || MP-WEIXIN this.children.forEach(vm=>{ vm.init() }) // #endif }, // 公开给用户使用,关闭全部 已经打开的组件 closeAll(){ this.children.forEach(vm=>{ // #ifdef APP-VUE || H5 || MP-WEIXIN vm.is_show = 'none' // #endif // #ifndef APP-VUE || H5 || MP-WEIXIN vm.close() // #endif }) }, closeOther(vm) { if (this.openItem && this.openItem !== vm) { // #ifdef APP-VUE || H5 || MP-WEIXIN this.openItem.is_show = 'none' // #endif // #ifndef APP-VUE || H5 || MP-WEIXIN this.openItem.close() // #endif } // 记录上一个打开的 swipe-action-item ,用于 auto-close this.openItem = vm } } }; </script> <style></style>
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue
Vue
unknown
1,256
let bindIngXMixins = {} // #ifdef APP-NVUE const BindingX = uni.requireNativePlugin('bindingx'); const dom = uni.requireNativePlugin('dom'); const animation = uni.requireNativePlugin('animation'); bindIngXMixins = { data() { return {} }, watch: { show(newVal) { if (this.autoClose) return if (this.stop) return this.stop = true if (newVal) { this.open(newVal) } else { this.close() } }, leftOptions() { this.getSelectorQuery() this.init() }, rightOptions(newVal) { this.init() } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.box = this.getEl(this.$refs['selector-box--hock']) this.selector = this.getEl(this.$refs['selector-content--hock']); this.leftButton = this.getEl(this.$refs['selector-left-button--hock']); this.rightButton = this.getEl(this.$refs['selector-right-button--hock']); this.init() }, // beforeDestroy() { // this.swipeaction.children.forEach((item, index) => { // if (item === this) { // this.swipeaction.children.splice(index, 1) // } // }) // }, methods: { init() { this.$nextTick(() => { this.x = 0 this.button = { show: false } setTimeout(() => { this.getSelectorQuery() }, 200) }) }, onClick(index, item, position) { this.$emit('click', { content: item, index, position }) }, touchstart(e) { // fix by mehaotian 禁止滑动 if (this.disabled) return // 每次只触发一次,避免多次监听造成闪烁 if (this.stop) return this.stop = true if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } const leftWidth = this.button.left.width const rightWidth = this.button.right.width let expression = this.range(this.x, -rightWidth, leftWidth) let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0) let rightExpression = this.range(this.x + rightWidth, 0, rightWidth) this.eventpan = BindingX.bind({ anchor: this.box, eventType: 'pan', props: [{ element: this.selector, property: 'transform.translateX', expression }, { element: this.leftButton, property: 'transform.translateX', expression: leftExpression }, { element: this.rightButton, property: 'transform.translateX', expression: rightExpression }, ] }, (e) => { // nope if (e.state === 'end') { this.x = e.deltaX + this.x; this.isclick = true this.bindTiming(e.deltaX) } }); }, touchend(e) { if (this.isopen !== 'none' && !this.isclick) { this.open('none') } }, bindTiming(x) { const left = this.x const leftWidth = this.button.left.width const rightWidth = this.button.right.width const threshold = this.threshold if (!this.isopen || this.isopen === 'none') { if (left > threshold) { this.open('left') } else if (left < -threshold) { this.open('right') } else { this.open('none') } } else { if ((x > -leftWidth && x < 0) || x > rightWidth) { if ((x > -threshold && x < 0) || (x - rightWidth > threshold)) { this.open('left') } else { this.open('none') } } else { if ((x < threshold && x > 0) || (x + leftWidth < -threshold)) { this.open('right') } else { this.open('none') } } } }, /** * 移动范围 * @param {Object} num * @param {Object} mix * @param {Object} max */ range(num, mix, max) { return `min(max(x+${num}, ${mix}), ${max})` }, /** * 开启swipe */ open(type) { this.animation(type) }, /** * 关闭swipe */ close() { this.animation('none') }, /** * 开启关闭动画 * @param {Object} type */ animation(type) { const time = 300 const leftWidth = this.button.left.width const rightWidth = this.button.right.width if (this.eventpan && this.eventpan.token) { BindingX.unbind({ token: this.eventpan.token, eventType: 'pan' }) } switch (type) { case 'left': Promise.all([ this.move(this.selector, leftWidth), this.move(this.leftButton, 0), this.move(this.rightButton, rightWidth * 2) ]).then(() => { this.setEmit(leftWidth, type) }) break case 'right': Promise.all([ this.move(this.selector, -rightWidth), this.move(this.leftButton, -leftWidth * 2), this.move(this.rightButton, 0) ]).then(() => { this.setEmit(-rightWidth, type) }) break default: Promise.all([ this.move(this.selector, 0), this.move(this.leftButton, -leftWidth), this.move(this.rightButton, rightWidth) ]).then(() => { this.setEmit(0, type) }) } }, setEmit(x, type) { const leftWidth = this.button.left.width const rightWidth = this.button.right.width this.isopen = this.isopen || 'none' this.stop = false this.isclick = false // 只有状态不一致才会返回结果 if (this.isopen !== type && this.x !== x) { if (type === 'left' && leftWidth > 0) { this.$emit('change', 'left') } if (type === 'right' && rightWidth > 0) { this.$emit('change', 'right') } if (type === 'none') { this.$emit('change', 'none') } } this.x = x this.isopen = type }, move(ref, value) { return new Promise((resolve, reject) => { animation.transition(ref, { styles: { transform: `translateX(${value})`, }, duration: 150, //ms timingFunction: 'linear', needLayout: false, delay: 0 //ms }, function(res) { resolve(res) }) }) }, /** * 获取ref * @param {Object} el */ getEl(el) { return el.ref }, /** * 获取节点信息 */ getSelectorQuery() { Promise.all([ this.getDom('left'), this.getDom('right'), ]).then((data) => { let show = 'none' if (this.autoClose) { show = 'none' } else { show = this.show } if (show === 'none') { // this.close() } else { this.open(show) } }) }, getDom(str) { return new Promise((resolve, reject) => { dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => { if (data) { this.button[str] = data.size resolve(data) } else { reject() } }) }) } } } // #endif export default bindIngXMixins
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js
JavaScript
unknown
6,533
export function isPC() { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (let v = 0; v < Agents.length - 1; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; }
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js
JavaScript
unknown
311
export default { data() { return { x: 0, transition: false, width: 0, viewWidth: 0, swipeShow: 0 } }, watch: { show(newVal) { if (this.autoClose) return if (newVal && newVal !== 'none') { this.transition = true this.open(newVal) } else { this.close() } } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.isopen = false setTimeout(() => { this.getQuerySelect() }, 50) }, methods: { appTouchStart(e) { const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, /** * 移动触发 * @param {Object} e */ onChange(e) { this.moveX = e.detail.x this.isclose = false }, touchstart(e) { this.transition = false this.isclose = true if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, touchmove(e) {}, touchend(e) { // 0的位置什么都不执行 if (this.isclose && this.isopen === 'none') return if (this.isclose && this.isopen !== 'none') { this.transition = true this.close() } else { this.move(this.moveX + this.leftWidth) } }, /** * 移动 * @param {Object} moveX */ move(moveX) { // 打开关闭的处理逻辑不太一样 this.transition = true // 未打开状态 if (!this.isopen || this.isopen === 'none') { if (moveX > this.threshold) { this.open('left') } else if (moveX < -this.threshold) { this.open('right') } else { this.close() } } else { if (moveX < 0 && moveX < this.rightWidth) { const rightX = this.rightWidth + moveX if (rightX < this.threshold) { this.open('right') } else { this.close() } } else if (moveX > 0 && moveX < this.leftWidth) { const leftX = this.leftWidth - moveX if (leftX < this.threshold) { this.open('left') } else { this.close() } } } }, /** * 打开 */ open(type) { this.x = this.moveX this.animation(type) }, /** * 关闭 */ close() { this.x = this.moveX // TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化 this.$nextTick(() => { this.x = -this.leftWidth if (this.isopen !== 'none') { this.$emit('change', 'none') } this.isopen = 'none' }) }, /** * 执行结束动画 * @param {Object} type */ animation(type) { this.$nextTick(() => { if (type === 'left') { this.x = 0 } else { this.x = -this.rightWidth - this.leftWidth } if (this.isopen !== type) { this.$emit('change', type) } this.isopen = type }) }, getSlide(x) {}, getQuerySelect() { const query = uni.createSelectorQuery().in(this); query.selectAll('.movable-view--hock').boundingClientRect(data => { this.leftWidth = data[1].width this.rightWidth = data[2].width this.width = data[0].width this.viewWidth = this.width + this.rightWidth + this.leftWidth if (this.leftWidth === 0) { // TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点 this.x = -0.1 } else { this.x = -this.leftWidth } this.moveX = this.x this.$nextTick(() => { this.swipeShow = 1 }) if (!this.buttonWidth) { this.disabledView = true } if (this.autoClose) return if (this.show !== 'none') { this.transition = true this.open(this.shows) } }).exec(); } } }
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js
JavaScript
unknown
4,065
let otherMixins = {} // #ifndef APP-PLUS|| MP-WEIXIN || H5 const MIN_DISTANCE = 10; otherMixins = { data() { // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` return { uniShow: false, left: 0, buttonShow: 'none', ani: false, moveLeft: '', elClass } }, watch: { show(newVal) { if (this.autoClose) return this.openState(newVal) }, left() { this.moveLeft = `translateX(${this.left}px)` }, buttonShow(newVal) { if (this.autoClose) return this.openState(newVal) }, leftOptions() { this.init() }, rightOptions() { this.init() } }, mounted() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } this.init() }, methods: { init() { clearTimeout(this.timer) this.timer = setTimeout(() => { this.getSelectorQuery() }, 100) // 移动距离 this.left = 0 this.x = 0 }, closeSwipe(e) { if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, appTouchStart(e) { const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, touchstart(e) { if (this.disabled) return this.ani = false this.x = this.left || 0 this.stopTouchStart(e) this.autoClose && this.closeSwipe() }, touchmove(e) { if (this.disabled) return // 是否可以滑动页面 this.stopTouchMove(e); if (this.direction !== 'horizontal') { return; } this.move(this.x + this.deltaX) return false }, touchend() { if (this.disabled) return this.moveDirection(this.left) }, /** * 设置移动距离 * @param {Object} value */ move(value) { value = value || 0 const leftWidth = this.leftWidth const rightWidth = this.rightWidth // 获取可滑动范围 this.left = this.range(value, -rightWidth, leftWidth); }, /** * 获取范围 * @param {Object} num * @param {Object} min * @param {Object} max */ range(num, min, max) { return Math.min(Math.max(num, min), max); }, /** * 移动方向判断 * @param {Object} left * @param {Object} value */ moveDirection(left) { const threshold = this.threshold const isopen = this.isopen || 'none' const leftWidth = this.leftWidth const rightWidth = this.rightWidth if (this.deltaX === 0) { this.openState('none') return } if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) { // right this.openState('right') } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) { // left this.openState('left') } else { // default this.openState('none') } }, /** * 开启状态 * @param {Boolean} type */ openState(type) { const leftWidth = this.leftWidth const rightWidth = this.rightWidth let left = '' this.isopen = this.isopen ? this.isopen : 'none' switch (type) { case "left": left = leftWidth break case "right": left = -rightWidth break default: left = 0 } if (this.isopen !== type) { this.throttle = true this.$emit('change', type) } this.isopen = type // 添加动画类 this.ani = true this.$nextTick(() => { this.move(left) }) // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 }, close() { this.openState('none') }, getDirection(x, y) { if (x > y && x > MIN_DISTANCE) { return 'horizontal'; } if (y > x && y > MIN_DISTANCE) { return 'vertical'; } return ''; }, /** * 重置滑动状态 * @param {Object} event */ resetTouchStatus() { this.direction = ''; this.deltaX = 0; this.deltaY = 0; this.offsetX = 0; this.offsetY = 0; }, /** * 设置滑动开始位置 * @param {Object} event */ stopTouchStart(event) { this.resetTouchStatus(); const touch = event.touches[0]; this.startX = touch.clientX; this.startY = touch.clientY; }, /** * 滑动中,是否禁止打开 * @param {Object} event */ stopTouchMove(event) { const touch = event.touches[0]; this.deltaX = touch.clientX - this.startX; this.deltaY = touch.clientY - this.startY; this.offsetX = Math.abs(this.deltaX); this.offsetY = Math.abs(this.deltaY); this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY); }, getSelectorQuery() { const views = uni.createSelectorQuery().in(this) views .selectAll('.' + this.elClass) .boundingClientRect(data => { if (data.length === 0) return let show = 'none' if (this.autoClose) { show = 'none' } else { show = this.show } this.leftWidth = data[0].width || 0 this.rightWidth = data[1].width || 0 this.buttonShow = show }) .exec() } } } // #endif export default otherMixins
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js
JavaScript
unknown
5,635
let mpMixins = {} let is_pc = null // #ifdef H5 import { isPC } from "./isPC" is_pc = isPC() // #endif // #ifdef APP-VUE|| MP-WEIXIN || H5 mpMixins = { data() { return { is_show: 'none' } }, watch: { show(newVal) { this.is_show = this.show } }, created() { this.swipeaction = this.getSwipeAction() if (this.swipeaction && Array.isArray(this.swipeaction.children)) { this.swipeaction.children.push(this) } }, mounted() { this.is_show = this.show }, methods: { // wxs 中调用 closeSwipe(e) { if (this.autoClose && this.swipeaction) { this.swipeaction.closeOther(this) } }, change(e) { this.$emit('change', e.open) if (this.is_show !== e.open) { this.is_show = e.open } }, appTouchStart(e) { if (is_pc) return const { clientX } = e.changedTouches[0] this.clientX = clientX this.timestamp = new Date().getTime() }, appTouchEnd(e, index, item, position) { if (is_pc) return const { clientX } = e.changedTouches[0] // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 let diff = Math.abs(this.clientX - clientX) let time = (new Date().getTime()) - this.timestamp if (diff < 40 && time < 300) { this.$emit('click', { content: item, index, position }) } }, onClickForPC(index, item, position) { if (!is_pc) return // #ifdef H5 this.$emit('click', { content: item, index, position }) // #endif } } } // #endif export default mpMixins
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js
JavaScript
unknown
1,536
const MIN_DISTANCE = 10; export default { showWatch(newVal, oldVal, ownerInstance, instance, self) { var state = self.state var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el if (!$el) return this.getDom(instance, ownerInstance, self) if (newVal && newVal !== 'none') { this.openState(newVal, instance, ownerInstance, self) return } if (state.left) { this.openState('none', instance, ownerInstance, self) } this.resetTouchStatus(instance, self) }, /** * 开始触摸操作 * @param {Object} e * @param {Object} ins */ touchstart(e, ownerInstance, self) { let instance = e.instance; let disabled = instance.getDataset().disabled let state = self.state; this.getDom(instance, ownerInstance, self) // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 开始触摸时移除动画类 instance.requestAnimationFrame(function() { instance.removeClass('ani'); ownerInstance.callMethod('closeSwipe'); }) // 记录上次的位置 state.x = state.left || 0 // 计算滑动开始位置 this.stopTouchStart(e, ownerInstance, self) }, /** * 开始滑动操作 * @param {Object} e * @param {Object} ownerInstance */ touchmove(e, ownerInstance, self) { let instance = e.instance; // 删除之后已经那不到实例了 if (!instance) return; let disabled = instance.getDataset().disabled let state = self.state // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 是否可以滑动页面 this.stopTouchMove(e, self); if (state.direction !== 'horizontal') { return; } if (e.preventDefault) { // 阻止页面滚动 e.preventDefault() } let x = state.x + state.deltaX this.move(x, instance, ownerInstance, self) }, /** * 结束触摸操作 * @param {Object} e * @param {Object} ownerInstance */ touchend(e, ownerInstance, self) { let instance = e.instance; let disabled = instance.getDataset().disabled let state = self.state // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 disabled = this.getDisabledType(disabled) if (disabled) return // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 this.moveDirection(state.left, instance, ownerInstance, self) }, /** * 设置移动距离 * @param {Object} value * @param {Object} instance * @param {Object} ownerInstance */ move(value, instance, ownerInstance, self) { value = value || 0 let state = self.state let leftWidth = state.leftWidth let rightWidth = state.rightWidth // 获取可滑动范围 state.left = this.range(value, -rightWidth, leftWidth); instance.requestAnimationFrame(function() { instance.setStyle({ transform: 'translateX(' + state.left + 'px)', '-webkit-transform': 'translateX(' + state.left + 'px)' }) }) }, /** * 获取元素信息 * @param {Object} instance * @param {Object} ownerInstance */ getDom(instance, ownerInstance, self) { var state = self.state var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el var leftDom = $el.querySelector('.button-group--left') var rightDom = $el.querySelector('.button-group--right') state.leftWidth = leftDom.offsetWidth || 0 state.rightWidth = rightDom.offsetWidth || 0 state.threshold = instance.getDataset().threshold }, getDisabledType(value) { return (typeof(value) === 'string' ? JSON.parse(value) : value) || false; }, /** * 获取范围 * @param {Object} num * @param {Object} min * @param {Object} max */ range(num, min, max) { return Math.min(Math.max(num, min), max); }, /** * 移动方向判断 * @param {Object} left * @param {Object} value * @param {Object} ownerInstance * @param {Object} ins */ moveDirection(left, ins, ownerInstance, self) { var state = self.state var threshold = state.threshold var position = state.position var isopen = state.isopen || 'none' var leftWidth = state.leftWidth var rightWidth = state.rightWidth if (state.deltaX === 0) { this.openState('none', ins, ownerInstance, self) return } if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) { // right this.openState('right', ins, ownerInstance, self) } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) { // left this.openState('left', ins, ownerInstance, self) } else { // default this.openState('none', ins, ownerInstance, self) } }, /** * 开启状态 * @param {Boolean} type * @param {Object} ins * @param {Object} ownerInstance */ openState(type, ins, ownerInstance, self) { let state = self.state let leftWidth = state.leftWidth let rightWidth = state.rightWidth let left = '' state.isopen = state.isopen ? state.isopen : 'none' switch (type) { case "left": left = leftWidth break case "right": left = -rightWidth break default: left = 0 } // && !state.throttle if (state.isopen !== type) { state.throttle = true ownerInstance.callMethod('change', { open: type }) } state.isopen = type // 添加动画类 ins.requestAnimationFrame(() => { ins.addClass('ani'); this.move(left, ins, ownerInstance, self) }) }, getDirection(x, y) { if (x > y && x > MIN_DISTANCE) { return 'horizontal'; } if (y > x && y > MIN_DISTANCE) { return 'vertical'; } return ''; }, /** * 重置滑动状态 * @param {Object} event */ resetTouchStatus(instance, self) { let state = self.state; state.direction = ''; state.deltaX = 0; state.deltaY = 0; state.offsetX = 0; state.offsetY = 0; }, /** * 设置滑动开始位置 * @param {Object} event */ stopTouchStart(event, ownerInstance, self) { let instance = event.instance; let state = self.state this.resetTouchStatus(instance, self); var touch = event.touches[0]; state.startX = touch.clientX; state.startY = touch.clientY; }, /** * 滑动中,是否禁止打开 * @param {Object} event */ stopTouchMove(event, self) { let instance = event.instance; let state = self.state; let touch = event.touches[0]; state.deltaX = touch.clientX - state.startX; state.deltaY = touch.clientY - state.startY; state.offsetY = Math.abs(state.deltaY); state.offsetX = Math.abs(state.deltaX); state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY); } }
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
JavaScript
unknown
6,990
<template> <!-- 在微信小程序 app vue端 h5 使用wxs 实现--> <!-- #ifdef APP-VUE || MP-WEIXIN || H5 --> <view class="uni-swipe"> <!-- #ifdef MP-WEIXIN || VUE3 --> <view class="uni-swipe_box" :change:prop="wxsswipe.showWatch" :prop="is_show" :data-threshold="threshold" :data-disabled="disabled" @touchstart="wxsswipe.touchstart" @touchmove="wxsswipe.touchmove" @touchend="wxsswipe.touchend"> <!-- #endif --> <!-- #ifndef MP-WEIXIN || VUE3 --> <view class="uni-swipe_box" :change:prop="renderswipe.showWatch" :prop="is_show" :data-threshold="threshold" :data-disabled="disabled+''" @touchstart="renderswipe.touchstart" @touchmove="renderswipe.touchmove" @touchend="renderswipe.touchend"> <!-- #endif --> <!-- 在微信小程序 app vue端 h5 使用wxs 实现--> <view class="uni-swipe_button-group button-group--left"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'left')" @click.stop="onClickForPC(index,item,'left')"> <text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> <view class="uni-swipe_text--center"> <slot></slot> </view> <view class="uni-swipe_button-group button-group--right"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'right')" @click.stop="onClickForPC(index,item,'right')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> </view> </view> <!-- #endif --> <!-- app nvue端 使用 bindingx --> <!-- #ifdef APP-NVUE --> <view ref="selector-box--hock" class="uni-swipe" @horizontalpan="touchstart" @touchend="touchend"> <view ref='selector-left-button--hock' class="uni-swipe_button-group button-group--left"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')"> <text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}"> {{ item.text }} </text> </view> </slot> </view> <view ref='selector-right-button--hock' class="uni-swipe_button-group button-group--right"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD' }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text> </view> </slot> </view> <view ref='selector-content--hock' class="uni-swipe_box"> <slot></slot> </view> </view> <!-- #endif --> <!-- 其他平台使用 js ,长列表性能可能会有影响--> <!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ --> <view class="uni-swipe"> <view class="uni-swipe_box" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend" :style="{transform:moveLeft}" :class="{ani:ani}"> <view class="uni-swipe_button-group button-group--left" :class="[elClass]"> <slot name="left"> <view v-for="(item,index) in leftOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px' }" class="uni-swipe_button button-hock" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'left')"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text> </view> </slot> </view> <slot></slot> <view class="uni-swipe_button-group button-group--right" :class="[elClass]"> <slot name="right"> <view v-for="(item,index) in rightOptions" :key="index" :style="{ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px' }" @touchstart.stop="appTouchStart" @touchend.stop="appTouchEnd($event,index,item,'right')" class="uni-swipe_button button-hock"><text class="uni-swipe_button-text" :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text> </view> </slot> </view> </view> </view> <!-- #endif --> </template> <script src="./wx.wxs" module="wxsswipe" lang="wxs"></script> <script module="renderswipe" lang="renderjs"> import render from './render.js' export default { mounted(e, ins, owner) { this.state = {} }, methods: { showWatch(newVal, oldVal, ownerInstance, instance) { render.showWatch(newVal, oldVal, ownerInstance, instance, this) }, touchstart(e, ownerInstance) { render.touchstart(e, ownerInstance, this) }, touchmove(e, ownerInstance) { render.touchmove(e, ownerInstance, this) }, touchend(e, ownerInstance) { render.touchend(e, ownerInstance, this) } } } </script> <script> import mpwxs from './mpwxs' import bindingx from './bindingx.js' import mpother from './mpother' /** * SwipeActionItem 滑动操作子组件 * @description 通过滑动触发选项的容器 * @tutorial https://ext.dcloud.net.cn/plugin?id=181 * @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效 * @property {Boolean} disabled = [true|false] 是否禁止滑动 * @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件 * @property {Number} threshold 滑动缺省值 * @property {Array} leftOptions 左侧选项内容及样式 * @property {Array} rightOptions 右侧选项内容及样式 * @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标) * @event {Function} change 组件打开或关闭时触发,left\right\none */ export default { mixins: [mpwxs, bindingx, mpother], emits: ['click', 'change'], props: { // 控制开关 show: { type: String, default: 'none' }, // 禁用 disabled: { type: Boolean, default: false }, // 是否自动关闭 autoClose: { type: Boolean, default: true }, // 滑动缺省距离 threshold: { type: Number, default: 20 }, // 左侧按钮内容 leftOptions: { type: Array, default () { return [] } }, // 右侧按钮内容 rightOptions: { type: Array, default () { return [] } } }, // #ifndef VUE3 // TODO vue2 destroyed() { if (this.__isUnmounted) return this.uninstall() }, // #endif // #ifdef VUE3 // TODO vue3 unmounted() { this.__isUnmounted = true this.uninstall() }, // #endif methods: { uninstall() { if (this.swipeaction) { this.swipeaction.children.forEach((item, index) => { if (item === this) { this.swipeaction.children.splice(index, 1) } }) } }, /** * 获取父元素实例 */ getSwipeAction(name = 'uniSwipeAction') { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== name) { parent = parent.$parent; if (!parent) return false; parentName = parent.$options.name; } return parent; } } } </script> <style lang="scss"> .uni-swipe { position: relative; /* #ifndef APP-NVUE */ overflow: hidden; /* #endif */ } .uni-swipe_box { /* #ifndef APP-NVUE */ display: flex; flex-shrink: 0; // touch-action: none; /* #endif */ position: relative; } .uni-swipe_content { // border: 1px red solid; } .uni-swipe_text--center { width: 100%; /* #ifndef APP-NVUE */ cursor: grab; /* #endif */ } .uni-swipe_button-group { /* #ifndef APP-NVUE */ box-sizing: border-box; display: flex; /* #endif */ flex-direction: row; position: absolute; top: 0; bottom: 0; /* #ifdef H5 */ cursor: pointer; /* #endif */ } .button-group--left { left: 0; transform: translateX(-100%) } .button-group--right { right: 0; transform: translateX(100%) } .uni-swipe_button { /* #ifdef APP-NVUE */ flex: 1; /* #endif */ /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; justify-content: center; align-items: center; padding: 0 20px; } .uni-swipe_button-text { /* #ifndef APP-NVUE */ flex-shrink: 0; /* #endif */ font-size: 14px; } .ani { transition-property: transform; transition-duration: 0.3s; transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1); } /* #ifdef MP-ALIPAY */ .movable-area { /* width: 100%; */ height: 45px; } .movable-view { display: flex; /* justify-content: center; */ position: relative; flex: 1; height: 45px; z-index: 2; } .movable-view-button { display: flex; flex-shrink: 0; flex-direction: row; height: 100%; background: #C0C0C0; } /* .transition { transition: all 0.3s; } */ .movable-view-box { flex-shrink: 0; height: 100%; background-color: #fff; } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue
Vue
unknown
10,479
<template> <view class="uni-swiper__warp"> <slot /> <view v-if="mode === 'default'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='default'> <view v-for="(item,index) in info" @click="clickItem(index)" :style="{ 'width': (index === current? dots.width*2:dots.width ) + 'px','height':dots.width/2 +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border-radius':'0px'}" :key="index" class="uni-swiper__dots-item uni-swiper__dots-bar" /> </view> <view v-if="mode === 'dot'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='dot'> <view v-for="(item,index) in info" @click="clickItem(index)" :style="{ 'width': dots.width + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}" :key="index" class="uni-swiper__dots-item" /> </view> <view v-if="mode === 'round'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='round'> <view v-for="(item,index) in info" @click="clickItem(index)" :class="[index === current&&'uni-swiper__dots-long']" :style="{ 'width':(index === current? dots.width*3:dots.width ) + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}" :key="index" class="uni-swiper__dots-item " /> </view> <view v-if="mode === 'nav'" key='nav' :style="{'background-color':dotsStyles.backgroundColor,'bottom':'0'}" class="uni-swiper__dots-box uni-swiper__dots-nav"> <text :style="{'color':dotsStyles.color}" class="uni-swiper__dots-nav-item">{{ (current+1)+"/"+info.length +' ' +info[current][field] }}</text> </view> <view v-if="mode === 'indexes'" key='indexes' :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box"> <view v-for="(item,index) in info" @click="clickItem(index)" :style="{ 'width':dots.width + 'px','height':dots.height +'px' ,'color':index === current?dots.selectedColor:dots.color,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}" :key="index" class="uni-swiper__dots-item uni-swiper__dots-indexes"><text class="uni-swiper__dots-indexes-text">{{ index+1 }}</text></view> </view> </view> </template> <script> /** * SwiperDod 轮播图指示点 * @description 自定义轮播图指示点 * @tutorial https://ext.dcloud.net.cn/plugin?id=284 * @property {Number} current 当前指示点索引,必须是通过 `swiper` 的 `change` 事件获取到的 `e.detail.current` * @property {String} mode = [default|round|nav|indexes] 指示点的类型 * @value defualt 默认指示点 * @value round 圆形指示点 * @value nav 条形指示点 * @value indexes 索引指示点 * @property {String} field mode 为 nav 时,显示的内容字段(mode = nav 时必填) * @property {String} info 轮播图的数据,通过数组长度决定指示点个数 * @property {Object} dotsStyles 指示点样式 * @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex} */ export default { name: 'UniSwiperDot', emits:['clickItem'], props: { info: { type: Array, default () { return [] } }, current: { type: Number, default: 0 }, dotsStyles: { type: Object, default () { return {} } }, // 类型 :default(默认) indexes long nav mode: { type: String, default: 'default' }, // 只在 nav 模式下生效,变量名称 field: { type: String, default: '' } }, data() { return { dots: { width: 6, height: 6, bottom: 10, color: '#fff', backgroundColor: 'rgba(0, 0, 0, .3)', border: '1px rgba(0, 0, 0, .3) solid', selectedBackgroundColor: '#333', selectedBorder: '1px rgba(0, 0, 0, .9) solid' } } }, watch: { dotsStyles(newVal) { this.dots = Object.assign(this.dots, this.dotsStyles) }, mode(newVal) { if (newVal === 'indexes') { this.dots.width = 14 this.dots.height = 14 } else { this.dots.width = 6 this.dots.height = 6 } } }, created() { if (this.mode === 'indexes') { this.dots.width = 12 this.dots.height = 12 } this.dots = Object.assign(this.dots, this.dotsStyles) }, methods: { clickItem(index) { this.$emit('clickItem', index) } } } </script> <style lang="scss" scoped> .uni-swiper__warp { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: column; position: relative; overflow: hidden; } .uni-swiper__dots-box { position: absolute; bottom: 10px; left: 0; right: 0; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; justify-content: center; align-items: center; } .uni-swiper__dots-item { width: 8px; border-radius: 100px; margin-left: 6px; background-color: rgba(0, 0, 0, 0.4); /* #ifndef APP-NVUE */ cursor: pointer; /* #endif */ /* #ifdef H5 */ // border-width: 5px 0; // border-style: solid; // border-color: transparent; // background-clip: padding-box; /* #endif */ // transition: width 0.2s linear; 不要取消注释,不然会不能变色 } .uni-swiper__dots-item:first-child { margin: 0; } .uni-swiper__dots-default { border-radius: 100px; } .uni-swiper__dots-long { border-radius: 50px; } .uni-swiper__dots-bar { border-radius: 50px; } .uni-swiper__dots-nav { bottom: 0px; // height: 26px; padding: 8px 0; /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex: 1; flex-direction: row; justify-content: flex-start; align-items: center; background-color: rgba(0, 0, 0, 0.2); } .uni-swiper__dots-nav-item { /* overflow: hidden; text-overflow: ellipsis; white-space: nowrap; */ font-size: 14px; color: #fff; margin: 0 15px; } .uni-swiper__dots-indexes { /* #ifndef APP-NVUE */ display: flex; /* #endif */ // flex: 1; justify-content: center; align-items: center; } .uni-swiper__dots-indexes-text { color: #fff; font-size: 12px; line-height: 14px; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-swiper-dot/components/uni-swiper-dot/uni-swiper-dot.vue
Vue
unknown
6,379
<template> <view class="uni-table-scroll" :class="{ 'table--border': border, 'border-none': !noData }"> <!-- #ifdef H5 --> <table class="uni-table" border="0" cellpadding="0" cellspacing="0" :class="{ 'table--stripe': stripe }" :style="{ 'min-width': minWidth + 'px' }"> <slot></slot> <tr v-if="noData" class="uni-table-loading"> <td class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</td> </tr> <view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view> </table> <!-- #endif --> <!-- #ifndef H5 --> <view class="uni-table" :style="{ 'min-width': minWidth + 'px' }" :class="{ 'table--stripe': stripe }"> <slot></slot> <view v-if="noData" class="uni-table-loading"> <view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view> </view> <view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view> </view> <!-- #endif --> </view> </template> <script> /** * Table 表格 * @description 用于展示多条结构类似的数据 * @tutorial https://ext.dcloud.net.cn/plugin?id=3270 * @property {Boolean} border 是否带有纵向边框 * @property {Boolean} stripe 是否显示斑马线 * @property {Boolean} type 是否开启多选 * @property {String} emptyText 空数据时显示的文本内容 * @property {Boolean} loading 显示加载中 * @event {Function} selection-change 开启多选时,当选择项发生变化时会触发该事件 */ export default { name: 'uniTable', options: { virtualHost: true }, emits:['selection-change'], props: { data: { type: Array, default() { return [] } }, // 是否有竖线 border: { type: Boolean, default: false }, // 是否显示斑马线 stripe: { type: Boolean, default: false }, // 多选 type: { type: String, default: '' }, // 没有更多数据 emptyText: { type: String, default: '没有更多数据' }, loading: { type: Boolean, default: false }, rowKey: { type: String, default: '' } }, data() { return { noData: true, minWidth: 0, multiTableHeads: [] } }, watch: { loading(val) {}, data(newVal) { let theadChildren = this.theadChildren let rowspan = 1 if (this.theadChildren) { rowspan = this.theadChildren.rowspan } // this.trChildren.length - rowspan this.noData = false // this.noData = newVal.length === 0 } }, created() { // 定义tr的实例数组 this.trChildren = [] this.thChildren = [] this.theadChildren = null this.backData = [] this.backIndexData = [] }, methods: { isNodata() { let theadChildren = this.theadChildren let rowspan = 1 if (this.theadChildren) { rowspan = this.theadChildren.rowspan } this.noData = this.trChildren.length - rowspan <= 0 }, /** * 选中所有 */ selectionAll() { let startIndex = 1 let theadChildren = this.theadChildren if (!this.theadChildren) { theadChildren = this.trChildren[0] } else { startIndex = theadChildren.rowspan - 1 } let isHaveData = this.data && this.data.length > 0 theadChildren.checked = true theadChildren.indeterminate = false this.trChildren.forEach((item, index) => { if (!item.disabled) { item.checked = true if (isHaveData && item.keyValue) { const row = this.data.find(v => v[this.rowKey] === item.keyValue) if (!this.backData.find(v => v[this.rowKey] === row[this.rowKey])) { this.backData.push(row) } } if (index > (startIndex - 1) && this.backIndexData.indexOf(index - startIndex) === -1) { this.backIndexData.push(index - startIndex) } } }) // this.backData = JSON.parse(JSON.stringify(this.data)) this.$emit('selection-change', { detail: { value: this.backData, index: this.backIndexData } }) }, /** * 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中) */ toggleRowSelection(row, selected) { // if (!this.theadChildren) return row = [].concat(row) this.trChildren.forEach((item, index) => { // if (item.keyValue) { const select = row.findIndex(v => { // if (typeof v === 'number') { return v === index - 1 } else { return v[this.rowKey] === item.keyValue } }) let ischeck = item.checked if (select !== -1) { if (typeof selected === 'boolean') { item.checked = selected } else { item.checked = !item.checked } if (ischeck !== item.checked) { this.check(item.rowData||item, item.checked, item.rowData?item.keyValue:null, true) } } // } }) this.$emit('selection-change', { detail: { value: this.backData, index:this.backIndexData } }) }, /** * 用于多选表格,清空用户的选择 */ clearSelection() { let theadChildren = this.theadChildren if (!this.theadChildren) { theadChildren = this.trChildren[0] } // if (!this.theadChildren) return theadChildren.checked = false theadChildren.indeterminate = false this.trChildren.forEach(item => { // if (item.keyValue) { item.checked = false // } }) this.backData = [] this.backIndexData = [] this.$emit('selection-change', { detail: { value: [], index: [] } }) }, /** * 用于多选表格,切换所有行的选中状态 */ toggleAllSelection() { let list = [] let startIndex = 1 let theadChildren = this.theadChildren if (!this.theadChildren) { theadChildren = this.trChildren[0] } else { startIndex = theadChildren.rowspan - 1 } this.trChildren.forEach((item, index) => { if (!item.disabled) { if (index > (startIndex - 1) ) { list.push(index-startIndex) } } }) this.toggleRowSelection(list) }, /** * 选中\取消选中 * @param {Object} child * @param {Object} check * @param {Object} rowValue */ check(child, check, keyValue, emit) { let theadChildren = this.theadChildren if (!this.theadChildren) { theadChildren = this.trChildren[0] } let childDomIndex = this.trChildren.findIndex((item, index) => child === item) if(childDomIndex < 0){ childDomIndex = this.data.findIndex(v=>v[this.rowKey] === keyValue) + 1 } const dataLen = this.trChildren.filter(v => !v.disabled && v.keyValue).length if (childDomIndex === 0) { check ? this.selectionAll() : this.clearSelection() return } if (check) { if (keyValue) { this.backData.push(child) } this.backIndexData.push(childDomIndex - 1) } else { const index = this.backData.findIndex(v => v[this.rowKey] === keyValue) const idx = this.backIndexData.findIndex(item => item === childDomIndex - 1) if (keyValue) { this.backData.splice(index, 1) } this.backIndexData.splice(idx, 1) } const domCheckAll = this.trChildren.find((item, index) => index > 0 && !item.checked && !item.disabled) if (!domCheckAll) { theadChildren.indeterminate = false theadChildren.checked = true } else { theadChildren.indeterminate = true theadChildren.checked = false } if (this.backIndexData.length === 0) { theadChildren.indeterminate = false } if (!emit) { this.$emit('selection-change', { detail: { value: this.backData, index: this.backIndexData } }) } } } } </script> <style lang="scss"> $border-color: #ebeef5; .uni-table-scroll { width: 100%; /* #ifndef APP-NVUE */ overflow-x: auto; /* #endif */ } .uni-table { position: relative; width: 100%; border-radius: 5px; // box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.1); background-color: #fff; /* #ifndef APP-NVUE */ box-sizing: border-box; display: table; overflow-x: auto; ::v-deep .uni-table-tr:nth-child(n + 2) { &:hover { background-color: #f5f7fa; } } ::v-deep .uni-table-thead { .uni-table-tr { // background-color: #f5f7fa; &:hover { background-color:#fafafa; } } } /* #endif */ } .table--border { border: 1px $border-color solid; border-right: none; } .border-none { /* #ifndef APP-NVUE */ border-bottom: none; /* #endif */ } .table--stripe { /* #ifndef APP-NVUE */ ::v-deep .uni-table-tr:nth-child(2n + 3) { background-color: #fafafa; } /* #endif */ } /* 表格加载、无数据样式 */ .uni-table-loading { position: relative; /* #ifndef APP-NVUE */ display: table-row; /* #endif */ height: 50px; line-height: 50px; overflow: hidden; box-sizing: border-box; } .empty-border { border-right: 1px $border-color solid; } .uni-table-text { position: absolute; right: 0; left: 0; text-align: center; font-size: 14px; color: #999; } .uni-table-mask { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-color: rgba(255, 255, 255, 0.8); z-index: 99; /* #ifndef APP-NVUE */ display: flex; margin: auto; transition: all 0.5s; /* #endif */ justify-content: center; align-items: center; } .uni-table--loader { width: 30px; height: 30px; border: 2px solid #aaa; // border-bottom-color: transparent; border-radius: 50%; /* #ifndef APP-NVUE */ animation: 2s uni-table--loader linear infinite; /* #endif */ position: relative; } @keyframes uni-table--loader { 0% { transform: rotate(360deg); } 10% { border-left-color: transparent; } 20% { border-bottom-color: transparent; } 30% { border-right-color: transparent; } 40% { border-top-color: transparent; } 50% { transform: rotate(0deg); } 60% { border-top-color: transparent; } 70% { border-left-color: transparent; } 80% { border-bottom-color: transparent; } 90% { border-right-color: transparent; } 100% { transform: rotate(-360deg); } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-table/uni-table.vue
Vue
unknown
10,031
<template> <!-- #ifdef H5 --> <tbody> <slot></slot> </tbody> <!-- #endif --> <!-- #ifndef H5 --> <view><slot></slot></view> <!-- #endif --> </template> <script> export default { name: 'uniBody', options: { virtualHost: true }, data() { return { } }, created() {}, methods: {} } </script> <style> </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-tbody/uni-tbody.vue
Vue
unknown
333
<template> <!-- #ifdef H5 --> <td class="uni-table-td" :rowspan="rowspan" :colspan="colspan" :class="{'table--border':border}" :style="{width:width + 'px','text-align':align}"> <slot></slot> </td> <!-- #endif --> <!-- #ifndef H5 --> <!-- :class="{'table--border':border}" --> <view class="uni-table-td" :class="{'table--border':border}" :style="{width:width + 'px','text-align':align}"> <slot></slot> </view> <!-- #endif --> </template> <script> /** * Td 单元格 * @description 表格中的标准单元格组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=3270 * @property {Number} align = [left|center|right] 单元格对齐方式 */ export default { name: 'uniTd', options: { virtualHost: true }, props: { width: { type: [String, Number], default: '' }, align: { type: String, default: 'left' }, rowspan: { type: [Number,String], default: 1 }, colspan: { type: [Number,String], default: 1 } }, data() { return { border: false }; }, created() { this.root = this.getTable() this.border = this.root.border }, methods: { /** * 获取父元素实例 */ getTable() { let parent = this.$parent; let parentName = parent.$options.name; while (parentName !== 'uniTable') { parent = parent.$parent; if (!parent) return false; parentName = parent.$options.name; } return parent; }, } } </script> <style lang="scss"> $border-color:#EBEEF5; .uni-table-td { display: table-cell; padding: 8px 10px; font-size: 14px; border-bottom: 1px $border-color solid; font-weight: 400; color: #606266; line-height: 23px; box-sizing: border-box; } .table--border { border-right: 1px $border-color solid; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-td/uni-td.vue
Vue
unknown
1,801
<template> <view class="uni-filter-dropdown"> <view class="dropdown-btn" @click="onDropdown"> <view class="icon-select" :class="{active: canReset}" v-if="isSelect || isRange"></view> <view class="icon-search" :class="{active: canReset}" v-if="isSearch"> <view class="icon-search-0"></view> <view class="icon-search-1"></view> </view> <view class="icon-calendar" :class="{active: canReset}" v-if="isDate"> <view class="icon-calendar-0"></view> <view class="icon-calendar-1"></view> </view> </view> <view class="uni-dropdown-cover" v-if="isOpened" @click="handleClose"></view> <view class="dropdown-popup dropdown-popup-right" v-if="isOpened" @click.stop> <!-- select--> <view v-if="isSelect" class="list"> <label class="flex-r a-i-c list-item" v-for="(item,index) in dataList" :key="index" @click="onItemClick($event, index)"> <check-box class="check" :checked="item.checked" /> <view class="checklist-content"> <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text> </view> </label> </view> <view v-if="isSelect" class="flex-r opera-area"> <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleSelectReset"> {{resource.reset}}</view> <view class="flex-f btn btn-submit" @click="handleSelectSubmit">{{resource.submit}}</view> </view> <!-- search --> <view v-if="isSearch" class="search-area"> <input class="search-input" v-model="filterValue" /> </view> <view v-if="isSearch" class="flex-r opera-area"> <view class="flex-f btn btn-submit" @click="handleSearchSubmit">{{resource.search}}</view> <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleSearchReset"> {{resource.reset}}</view> </view> <!-- range --> <view v-if="isRange"> <view class="input-label">{{resource.gt}}</view> <input class="input" v-model="gtValue" /> <view class="input-label">{{resource.lt}}</view> <input class="input" v-model="ltValue" /> </view> <view v-if="isRange" class="flex-r opera-area"> <view class="flex-f btn btn-default" :class="{disable: !canReset}" @click="handleRangeReset"> {{resource.reset}}</view> <view class="flex-f btn btn-submit" @click="handleRangeSubmit">{{resource.submit}}</view> </view> <!-- date --> <view v-if="isDate"> <uni-datetime-picker ref="datetimepicker" :value="dateRange" type="datetimerange" return-type="timestamp" @change="datetimechange" @maskClick="timepickerclose"> <view></view> </uni-datetime-picker> </view> </view> </view> </template> <script> import checkBox from '../uni-tr/table-checkbox.vue' const resource = { "reset": "重置", "search": "搜索", "submit": "确定", "filter": "筛选", "gt": "大于等于", "lt": "小于等于", "date": "日期范围" } const DropdownType = { Select: "select", Search: "search", Range: "range", Date: "date", Timestamp: "timestamp" } export default { name: 'FilterDropdown', emits:['change'], components: { checkBox }, options: { virtualHost: true }, props: { filterType: { type: String, default: DropdownType.Select }, filterData: { type: Array, default () { return [] } }, mode: { type: String, default: 'default' }, map: { type: Object, default () { return { text: 'text', value: 'value' } } }, filterDefaultValue: { type: [Array,String], default () { return "" } } }, computed: { canReset() { if (this.isSearch) { return this.filterValue.length > 0 } if (this.isSelect) { return this.checkedValues.length > 0 } if (this.isRange) { return (this.gtValue.length > 0 && this.ltValue.length > 0) } if (this.isDate) { return this.dateSelect.length > 0 } return false }, isSelect() { return this.filterType === DropdownType.Select }, isSearch() { return this.filterType === DropdownType.Search }, isRange() { return this.filterType === DropdownType.Range }, isDate() { return (this.filterType === DropdownType.Date || this.filterType === DropdownType.Timestamp) } }, watch: { filterData(newVal) { this._copyFilters() }, indeterminate(newVal) { this.isIndeterminate = newVal } }, data() { return { resource, enabled: true, isOpened: false, dataList: [], filterValue: this.filterDefaultValue, checkedValues: [], gtValue: '', ltValue: '', dateRange: [], dateSelect: [] }; }, created() { this._copyFilters() }, methods: { _copyFilters() { let dl = JSON.parse(JSON.stringify(this.filterData)) for (let i = 0; i < dl.length; i++) { if (dl[i].checked === undefined) { dl[i].checked = false } } this.dataList = dl }, openPopup() { this.isOpened = true if (this.isDate) { this.$nextTick(() => { if (!this.dateRange.length) { this.resetDate() } this.$refs.datetimepicker.show() }) } }, closePopup() { this.isOpened = false }, handleClose(e) { this.closePopup() }, resetDate() { let date = new Date() let dateText = date.toISOString().split('T')[0] this.dateRange = [dateText + ' 0:00:00', dateText + ' 23:59:59'] }, onDropdown(e) { this.openPopup() }, onItemClick(e, index) { let items = this.dataList let listItem = items[index] if (listItem.checked === undefined) { items[index].checked = true } else { items[index].checked = !listItem.checked } let checkvalues = [] for (let i = 0; i < items.length; i++) { const item = items[i] if (item.checked) { checkvalues.push(item.value) } } this.checkedValues = checkvalues }, datetimechange(e) { this.closePopup() this.dateRange = e this.dateSelect = e this.$emit('change', { filterType: this.filterType, filter: e }) }, timepickerclose(e) { this.closePopup() }, handleSelectSubmit() { this.closePopup() this.$emit('change', { filterType: this.filterType, filter: this.checkedValues }) }, handleSelectReset() { if (!this.canReset) { return; } var items = this.dataList for (let i = 0; i < items.length; i++) { let item = items[i] this.$set(item, 'checked', false) } this.checkedValues = [] this.handleSelectSubmit() }, handleSearchSubmit() { this.closePopup() this.$emit('change', { filterType: this.filterType, filter: this.filterValue }) }, handleSearchReset() { if (!this.canReset) { return; } this.filterValue = '' this.handleSearchSubmit() }, handleRangeSubmit(isReset) { this.closePopup() this.$emit('change', { filterType: this.filterType, filter: isReset === true ? [] : [parseInt(this.gtValue), parseInt(this.ltValue)] }) }, handleRangeReset() { if (!this.canReset) { return; } this.gtValue = '' this.ltValue = '' this.handleRangeSubmit(true) } } } </script> <style lang="scss"> $uni-primary: #1890ff !default; .flex-r { display: flex; flex-direction: row; } .flex-f { flex: 1; } .a-i-c { align-items: center; } .j-c-c { justify-content: center; } .icon-select { width: 14px; height: 16px; border: solid 6px transparent; border-top: solid 6px #ddd; border-bottom: none; background-color: #ddd; background-clip: content-box; box-sizing: border-box; } .icon-select.active { background-color: $uni-primary; border-top-color: $uni-primary; } .icon-search { width: 12px; height: 16px; position: relative; } .icon-search-0 { border: 2px solid #ddd; border-radius: 8px; width: 7px; height: 7px; } .icon-search-1 { position: absolute; top: 8px; right: 0; width: 1px; height: 7px; background-color: #ddd; transform: rotate(-45deg); } .icon-search.active .icon-search-0 { border-color: $uni-primary; } .icon-search.active .icon-search-1 { background-color: $uni-primary; } .icon-calendar { color: #ddd; width: 14px; height: 16px; } .icon-calendar-0 { height: 4px; margin-top: 3px; margin-bottom: 1px; background-color: #ddd; border-radius: 2px 2px 1px 1px; position: relative; } .icon-calendar-0:before, .icon-calendar-0:after { content: ''; position: absolute; top: -3px; width: 4px; height: 3px; border-radius: 1px; background-color: #ddd; } .icon-calendar-0:before { left: 2px; } .icon-calendar-0:after { right: 2px; } .icon-calendar-1 { height: 9px; background-color: #ddd; border-radius: 1px 1px 2px 2px; } .icon-calendar.active { color: $uni-primary; } .icon-calendar.active .icon-calendar-0, .icon-calendar.active .icon-calendar-1, .icon-calendar.active .icon-calendar-0:before, .icon-calendar.active .icon-calendar-0:after { background-color: $uni-primary; } .uni-filter-dropdown { position: relative; font-weight: normal; } .dropdown-popup { position: absolute; top: 100%; background-color: #fff; box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d; min-width: 150px; z-index: 1000; } .dropdown-popup-left { left: 0; } .dropdown-popup-right { right: 0; } .uni-dropdown-cover { position: fixed; left: 0; top: 0; right: 0; bottom: 0; background-color: transparent; z-index: 100; } .list { margin-top: 5px; margin-bottom: 5px; } .list-item { padding: 5px 10px; text-align: left; } .list-item:hover { background-color: #f0f0f0; } .check { margin-right: 5px; } .search-area { padding: 10px; } .search-input { font-size: 12px; border: 1px solid #f0f0f0; border-radius: 3px; padding: 2px 5px; min-width: 150px; text-align: left; } .input-label { margin: 10px 10px 5px 10px; text-align: left; } .input { font-size: 12px; border: 1px solid #f0f0f0; border-radius: 3px; margin: 10px; padding: 2px 5px; min-width: 150px; text-align: left; } .opera-area { cursor: default; border-top: 1px solid #ddd; padding: 5px; } .opera-area .btn { font-size: 12px; border-radius: 3px; margin: 5px; padding: 4px 4px; } .btn-default { border: 1px solid #ddd; } .btn-default.disable { border-color: transparent; } .btn-submit { background-color: $uni-primary; color: #ffffff; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-th/filter-dropdown.vue
Vue
unknown
10,617
<template> <!-- #ifdef H5 --> <th :rowspan="rowspan" :colspan="colspan" class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"> <view class="uni-table-th-row"> <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort"> <slot></slot> <view v-if="sortable" class="arrow-box"> <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text> <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text> </view> </view> <dropdown v-if="filterType || filterData.length" :filterDefaultValue="filterDefaultValue" :filterData="filterData" :filterType="filterType" @change="ondropdown"></dropdown> </view> </th> <!-- #endif --> <!-- #ifndef H5 --> <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view> <!-- #endif --> </template> <script> // #ifdef H5 import dropdown from './filter-dropdown.vue' // #endif /** * Th 表头 * @description 表格内的表头单元格组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=3270 * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx) * @property {Boolean} sortable 是否启用排序 * @property {Number} align = [left|center|right] 单元格对齐方式 * @value left 单元格文字左侧对齐 * @value center 单元格文字居中 * @value right 单元格文字右侧对齐 * @property {Array} filterData 筛选数据 * @property {String} filterType [search|select] 筛选类型 * @value search 关键字搜素 * @value select 条件选择 * @event {Function} sort-change 排序触发事件 */ export default { name: 'uniTh', options: { virtualHost: true }, components: { // #ifdef H5 dropdown // #endif }, emits:['sort-change','filter-change'], props: { width: { type: [String, Number], default: '' }, align: { type: String, default: 'left' }, rowspan: { type: [Number, String], default: 1 }, colspan: { type: [Number, String], default: 1 }, sortable: { type: Boolean, default: false }, filterType: { type: String, default: "" }, filterData: { type: Array, default () { return [] } }, filterDefaultValue: { type: [Array,String], default () { return "" } } }, data() { return { border: false, ascending: false, descending: false } }, computed: { // 根据props中的width属性 自动匹配当前th的宽度(px) customWidth(){ if(typeof this.width === 'number'){ return this.width } else if(typeof this.width === 'string') { let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g) let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g) let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g) if (this.width.match(regexHaveUnitPx) !== null) { // 携带了 px return this.width.replace('px', '') } else if (this.width.match(regexHaveUnitRpx) !== null) { // 携带了 rpx let numberRpx = Number(this.width.replace('rpx', '')) let widthCoe = uni.getSystemInfoSync().screenWidth / 750 return Math.round(numberRpx * widthCoe) } else if (this.width.match(regexHaveNotUnit) !== null) { // 未携带 rpx或px 的纯数字 String return this.width } else { // 不符合格式 return '' } } else { return '' } }, contentAlign() { let align = 'left' switch (this.align) { case 'left': align = 'flex-start' break case 'center': align = 'center' break case 'right': align = 'flex-end' break } return align } }, created() { this.root = this.getTable('uniTable') this.rootTr = this.getTable('uniTr') this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140) this.border = this.root.border this.root.thChildren.push(this) }, methods: { sort() { if (!this.sortable) return this.clearOther() if (!this.ascending && !this.descending) { this.ascending = true this.$emit('sort-change', { order: 'ascending' }) return } if (this.ascending && !this.descending) { this.ascending = false this.descending = true this.$emit('sort-change', { order: 'descending' }) return } if (!this.ascending && this.descending) { this.ascending = false this.descending = false this.$emit('sort-change', { order: null }) } }, ascendingFn() { this.clearOther() this.ascending = !this.ascending this.descending = false this.$emit('sort-change', { order: this.ascending ? 'ascending' : null }) }, descendingFn() { this.clearOther() this.descending = !this.descending this.ascending = false this.$emit('sort-change', { order: this.descending ? 'descending' : null }) }, clearOther() { this.root.thChildren.map(item => { if (item !== this) { item.ascending = false item.descending = false } return item }) }, ondropdown(e) { this.$emit("filter-change", e) }, /** * 获取父元素实例 */ getTable(name) { let parent = this.$parent let parentName = parent.$options.name while (parentName !== name) { parent = parent.$parent if (!parent) return false parentName = parent.$options.name } return parent } } } </script> <style lang="scss"> $border-color: #ebeef5; $uni-primary: #007aff !default; .uni-table-th { padding: 12px 10px; /* #ifndef APP-NVUE */ display: table-cell; box-sizing: border-box; /* #endif */ font-size: 14px; font-weight: bold; color: #909399; border-bottom: 1px $border-color solid; } .uni-table-th-row { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: row; } .table--border { border-right: 1px $border-color solid; } .uni-table-th-content { display: flex; align-items: center; flex: 1; } .arrow-box { } .arrow { display: block; position: relative; width: 10px; height: 8px; // border: 1px red solid; left: 5px; overflow: hidden; cursor: pointer; } .down { top: 3px; ::after { content: ''; width: 8px; height: 8px; position: absolute; left: 2px; top: -5px; transform: rotate(45deg); background-color: #ccc; } &.active { ::after { background-color: $uni-primary; } } } .up { ::after { content: ''; width: 8px; height: 8px; position: absolute; left: 2px; top: 5px; transform: rotate(45deg); background-color: #ccc; } &.active { ::after { background-color: $uni-primary; } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-th/uni-th.vue
Vue
unknown
6,627
<template> <!-- #ifdef H5 --> <thead class="uni-table-thead"> <tr class="uni-table-tr"> <th :rowspan="rowspan" colspan="1" class="checkbox" :class="{ 'tr-table--border': border }"> <table-checkbox :indeterminate="indeterminate" :checked="checked" @checkboxSelected="checkboxSelected"></table-checkbox> </th> </tr> <slot></slot> </thead> <!-- #endif --> <!-- #ifndef H5 --> <view class="uni-table-thead"> <slot></slot> </view> <!-- #endif --> </template> <script> import tableCheckbox from '../uni-tr/table-checkbox.vue' export default { name: 'uniThead', components: { tableCheckbox }, options: { // #ifdef MP-TOUTIAO virtualHost: false, // #endif // #ifndef MP-TOUTIAO virtualHost: true // #endif }, data() { return { border: false, selection: false, rowspan: 1, indeterminate: false, checked: false } }, created() { this.root = this.getTable() // #ifdef H5 this.root.theadChildren = this // #endif this.border = this.root.border this.selection = this.root.type }, methods: { init(self) { this.rowspan++ }, checkboxSelected(e) { this.indeterminate = false const backIndexData = this.root.backIndexData const data = this.root.trChildren.filter(v => !v.disabled && v.keyValue) if (backIndexData.length === data.length) { this.checked = false this.root.clearSelection() } else { this.checked = true this.root.selectionAll() } }, /** * 获取父元素实例 */ getTable(name = 'uniTable') { let parent = this.$parent let parentName = parent.$options.name while (parentName !== name) { parent = parent.$parent if (!parent) return false parentName = parent.$options.name } return parent } } } </script> <style lang="scss"> $border-color: #ebeef5; .uni-table-thead { display: table-header-group; } .uni-table-tr { /* #ifndef APP-NVUE */ display: table-row; transition: all 0.3s; box-sizing: border-box; /* #endif */ border: 1px red solid; background-color: #fafafa; } .checkbox { padding: 0 8px; width: 26px; padding-left: 12px; /* #ifndef APP-NVUE */ display: table-cell; vertical-align: middle; /* #endif */ color: #333; font-weight: 500; border-bottom: 1px $border-color solid; font-size: 14px; // text-align: center; } .tr-table--border { border-right: 1px $border-color solid; } /* #ifndef APP-NVUE */ .uni-table-tr { ::v-deep .uni-table-th { &.table--border:last-child { // border-right: none; } } ::v-deep .uni-table-td { &.table--border:last-child { // border-right: none; } } } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-thead/uni-thead.vue
Vue
unknown
2,728
<template> <view class="uni-table-checkbox" @click="selected"> <view v-if="!indeterminate" class="checkbox__inner" :class="{'is-checked':isChecked,'is-disable':isDisabled}"> <view class="checkbox__inner-icon"></view> </view> <view v-else class="checkbox__inner checkbox--indeterminate"> <view class="checkbox__inner-icon"></view> </view> </view> </template> <script> export default { name: 'TableCheckbox', emits:['checkboxSelected'], props: { indeterminate: { type: Boolean, default: false }, checked: { type: [Boolean,String], default: false }, disabled: { type: Boolean, default: false }, index: { type: Number, default: -1 }, cellData: { type: Object, default () { return {} } } }, watch:{ checked(newVal){ if(typeof this.checked === 'boolean'){ this.isChecked = newVal }else{ this.isChecked = true } }, indeterminate(newVal){ this.isIndeterminate = newVal } }, data() { return { isChecked: false, isDisabled: false, isIndeterminate:false } }, created() { if(typeof this.checked === 'boolean'){ this.isChecked = this.checked } this.isDisabled = this.disabled }, methods: { selected() { if (this.isDisabled) return this.isIndeterminate = false this.isChecked = !this.isChecked this.$emit('checkboxSelected', { checked: this.isChecked, data: this.cellData }) } } } </script> <style lang="scss"> $uni-primary: #007aff !default; $border-color: #DCDFE6; $disable:0.4; .uni-table-checkbox { display: flex; flex-direction: row; align-items: center; justify-content: center; position: relative; margin: 5px 0; cursor: pointer; // 多选样式 .checkbox__inner { /* #ifndef APP-NVUE */ flex-shrink: 0; box-sizing: border-box; /* #endif */ position: relative; width: 16px; height: 16px; border: 1px solid $border-color; border-radius: 2px; background-color: #fff; z-index: 1; .checkbox__inner-icon { position: absolute; /* #ifdef APP-NVUE */ top: 2px; /* #endif */ /* #ifndef APP-NVUE */ top: 2px; /* #endif */ left: 5px; height: 7px; width: 3px; border: 1px solid #fff; border-left: 0; border-top: 0; opacity: 0; transform-origin: center; transform: rotate(45deg); box-sizing: content-box; } &.checkbox--indeterminate { border-color: $uni-primary; background-color: $uni-primary; .checkbox__inner-icon { position: absolute; opacity: 1; transform: rotate(0deg); height: 2px; top: 0; bottom: 0; margin: auto; left: 0px; right: 0px; bottom: 0; width: auto; border: none; border-radius: 2px; transform: scale(0.5); background-color: #fff; } } &:hover{ border-color: $uni-primary; } // 禁用 &.is-disable { /* #ifdef H5 */ cursor: not-allowed; /* #endif */ background-color: #F2F6FC; border-color: $border-color; } // 选中 &.is-checked { border-color: $uni-primary; background-color: $uni-primary; .checkbox__inner-icon { opacity: 1; transform: rotate(45deg); } // 选中禁用 &.is-disable { opacity: $disable; } } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-tr/table-checkbox.vue
Vue
unknown
3,382
<template> <!-- #ifdef H5 --> <tr class="uni-table-tr"> <th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }"> <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox> </th> <slot></slot> <!-- <uni-th class="th-fixed">123</uni-th> --> </tr> <!-- #endif --> <!-- #ifndef H5 --> <view class="uni-table-tr"> <view v-if="selection === 'selection' " class="checkbox" :class="{ 'tr-table--border': border }"> <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox> </view> <slot></slot> </view> <!-- #endif --> </template> <script> import tableCheckbox from './table-checkbox.vue' /** * Tr 表格行组件 * @description 表格行组件 仅包含 th,td 组件 * @tutorial https://ext.dcloud.net.cn/plugin?id= */ export default { name: 'uniTr', components: { tableCheckbox }, props: { disabled: { type: Boolean, default: false }, keyValue: { type: [String, Number], default: '' } }, options: { // #ifdef MP-TOUTIAO virtualHost: false, // #endif // #ifndef MP-TOUTIAO virtualHost: true // #endif }, data() { return { value: false, border: false, selection: false, widthThArr: [], ishead: true, checked: false, indeterminate: false } }, created() { this.root = this.getTable() this.head = this.getTable('uniThead') if (this.head) { this.ishead = false this.head.init(this) } this.border = this.root.border this.selection = this.root.type this.root.trChildren.push(this) const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue) if (rowData) { this.rowData = rowData } this.root.isNodata() }, mounted() { if (this.widthThArr.length > 0) { const selectionWidth = this.selection === 'selection' ? 50 : 0 this.root.minWidth = Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) + selectionWidth; } }, // #ifndef VUE3 destroyed() { const index = this.root.trChildren.findIndex(i => i === this) this.root.trChildren.splice(index, 1) this.root.isNodata() }, // #endif // #ifdef VUE3 unmounted() { const index = this.root.trChildren.findIndex(i => i === this) this.root.trChildren.splice(index, 1) this.root.isNodata() }, // #endif methods: { minWidthUpdate(width) { this.widthThArr.push(width) if (this.widthThArr.length > 0) { const selectionWidth = this.selection === 'selection' ? 50 : 0; this.root.minWidth = Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) + selectionWidth; } }, // 选中 checkboxSelected(e) { let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue) this.checked = e.checked this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null) }, change(e) { this.root.trChildren.forEach(item => { if (item === this) { this.root.check(this, e.detail.value.length > 0 ? true : false) } }) }, /** * 获取父元素实例 */ getTable(name = 'uniTable') { let parent = this.$parent let parentName = parent.$options.name while (parentName !== name) { parent = parent.$parent if (!parent) return false parentName = parent.$options.name } return parent } } } </script> <style lang="scss"> $border-color: #ebeef5; .uni-table-tr { /* #ifndef APP-NVUE */ display: table-row; transition: all 0.3s; box-sizing: border-box; /* #endif */ } .checkbox { padding: 0 8px; width: 26px; padding-left: 12px; /* #ifndef APP-NVUE */ display: table-cell; vertical-align: middle; /* #endif */ color: #333; font-weight: 500; border-bottom: 1px $border-color solid; font-size: 14px; // text-align: center; } .tr-table--border { border-right: 1px $border-color solid; } /* #ifndef APP-NVUE */ .uni-table-tr { ::v-deep .uni-table-th { &.table--border:last-child { // border-right: none; } } ::v-deep .uni-table-td { &.table--border:last-child { // border-right: none; } } } /* #endif */ </style>
2301_77169380/AppruanjianApk
uni_modules/uni-table/components/uni-tr/uni-tr.vue
Vue
unknown
4,344
import en from './en.json' import es from './es.json' import fr from './fr.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, es, fr, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uni-table/i18n/index.js
JavaScript
unknown
226
<template> <text class="uni-tag" v-if="text" :class="classes" :style="customStyle" @click="onClick">{{text}}</text> </template> <script> /** * Tag 标签 * @description 用于展示1个或多个文字标签,可点击切换选中、不选中的状态 * @tutorial https://ext.dcloud.net.cn/plugin?id=35 * @property {String} text 标签内容 * @property {String} size = [default|small|mini] 大小尺寸 * @value default 正常 * @value small 小尺寸 * @value mini 迷你尺寸 * @property {String} type = [default|primary|success|warning|error] 颜色类型 * @value default 灰色 * @value primary 蓝色 * @value success 绿色 * @value warning 黄色 * @value error 红色 * @property {Boolean} disabled = [true|false] 是否为禁用状态 * @property {Boolean} inverted = [true|false] 是否无需背景颜色(空心标签) * @property {Boolean} circle = [true|false] 是否为圆角 * @event {Function} click 点击 Tag 触发事件 */ export default { name: "UniTag", emits: ['click'], props: { type: { // 标签类型default、primary、success、warning、error、royal type: String, default: "default" }, size: { // 标签大小 normal, small type: String, default: "normal" }, // 标签内容 text: { type: String, default: "" }, disabled: { // 是否为禁用状态 type: [Boolean, String], default: false }, inverted: { // 是否为空心 type: [Boolean, String], default: false }, circle: { // 是否为圆角样式 type: [Boolean, String], default: false }, mark: { // 是否为标记样式 type: [Boolean, String], default: false }, customStyle: { type: String, default: '' } }, computed: { classes() { const { type, disabled, inverted, circle, mark, size, isTrue } = this const classArr = [ 'uni-tag--' + type, 'uni-tag--' + size, isTrue(disabled) ? 'uni-tag--disabled' : '', isTrue(inverted) ? 'uni-tag--' + type + '--inverted' : '', isTrue(circle) ? 'uni-tag--circle' : '', isTrue(mark) ? 'uni-tag--mark' : '', // type === 'default' ? 'uni-tag--default' : 'uni-tag-text', isTrue(inverted) ? 'uni-tag--inverted uni-tag-text--' + type : '', size === 'small' ? 'uni-tag-text--small' : '' ] // 返回类的字符串,兼容字节小程序 return classArr.join(' ') } }, methods: { isTrue(value) { return value === true || value === 'true' }, onClick() { if (this.isTrue(this.disabled)) return this.$emit("click"); } } }; </script> <style lang="scss" scoped> $uni-primary: #2979ff !default; $uni-success: #18bc37 !default; $uni-warning: #f3a73f !default; $uni-error: #e43d33 !default; $uni-info: #8f939c !default; $tag-default-pd: 4px 7px; $tag-small-pd: 2px 5px; $tag-mini-pd: 1px 3px; .uni-tag { line-height: 14px; font-size: 12px; font-weight: 200; padding: $tag-default-pd; color: #fff; border-radius: 3px; background-color: $uni-info; border-width: 1px; border-style: solid; border-color: $uni-info; /* #ifdef H5 */ cursor: pointer; /* #endif */ // size attr &--default { font-size: 12px; } &--default--inverted { color: $uni-info; border-color: $uni-info; } &--small { padding: $tag-small-pd; font-size: 12px; border-radius: 2px; } &--mini { padding: $tag-mini-pd; font-size: 12px; border-radius: 2px; } // type attr &--primary { background-color: $uni-primary; border-color: $uni-primary; color: #fff; } &--success { color: #fff; background-color: $uni-success; border-color: $uni-success; } &--warning { color: #fff; background-color: $uni-warning; border-color: $uni-warning; } &--error { color: #fff; background-color: $uni-error; border-color: $uni-error; } &--primary--inverted { color: $uni-primary; border-color: $uni-primary; } &--success--inverted { color: $uni-success; border-color: $uni-success; } &--warning--inverted { color: $uni-warning; border-color: $uni-warning; } &--error--inverted { color: $uni-error; border-color: $uni-error; } &--inverted { background-color: #fff; } // other attr &--circle { border-radius: 15px; } &--mark { border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: 15px; border-bottom-right-radius: 15px; } &--disabled { opacity: 0.5; /* #ifdef H5 */ cursor: not-allowed; /* #endif */ } } .uni-tag-text { color: #fff; font-size: 14px; &--primary { color: $uni-primary; } &--success { color: $uni-success; } &--warning { color: $uni-warning; } &--error { color: $uni-error; } &--small { font-size: 12px; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-tag/components/uni-tag/uni-tag.vue
Vue
unknown
4,950
<template> <view> 测试插件 </view> </template> <script> export default { data() { return { }; }, onLoad() { let fonts = [] let obj = {} fonts.forEach(v=>{ obj[v.name] = '\\u'+v.unicode }) } } </script> <style> </style>
2301_77169380/AppruanjianApk
uni_modules/uni-test/components/uni-test/uni-test.vue
Vue
unknown
267
<template> <view class="uni-title__box" :style="{'align-items':textAlign}"> <text class="uni-title__base" :class="['uni-'+type]" :style="{'color':color}">{{title}}</text> </view> </template> <script> /** * Title 标题 * @description 标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题 * @tutorial https://ext.dcloud.net.cn/plugin?id=1066 * @property {String} type = [h1|h2|h3|h4|h5] 标题类型 * @value h1 一级标题 * @value h2 二级标题 * @value h3 三级标题 * @value h4 四级标题 * @value h5 五级标题 * @property {String} title 标题内容 * @property {String} align = [left|center|right] 对齐方式 * @value left 做对齐 * @value center 居中对齐 * @value right 右对齐 * @property {String} color 字体颜色 * @property {Boolean} stat = [true|false] 是否开启统计功能呢,如不填写type值,默认为开启,填写 type 属性,默认为关闭 */ export default { name:"UniTitle", props: { type: { type: String, default: '' }, title: { type: String, default: '' }, align: { type: String, default: 'left' }, color: { type: String, default: '#333333' }, stat: { type: [Boolean, String], default: '' } }, data() { return { }; }, computed: { textAlign() { let align = 'center'; switch (this.align) { case 'left': align = 'flex-start' break; case 'center': align = 'center' break; case 'right': align = 'flex-end' break; } return align } }, watch: { title(newVal) { if (this.isOpenStat()) { // 上报数据 if (uni.report) { uni.report('title', this.title) } } } }, mounted() { if (this.isOpenStat()) { // 上报数据 if (uni.report) { uni.report('title', this.title) } } }, methods: { isOpenStat() { if (this.stat === '') { this.isStat = false } let stat_type = (typeof(this.stat) === 'boolean' && this.stat) || (typeof(this.stat) === 'string' && this.stat !== '') if (this.type === "") { this.isStat = true if (this.stat.toString() === 'false') { this.isStat = false } } if (this.type !== '') { this.isStat = true if (stat_type) { this.isStat = true } else { this.isStat = false } } return this.isStat } } } </script> <style> /* .uni-title { } */ .uni-title__box { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: column; align-items: flex-start; justify-content: center; padding: 8px 0; flex: 1; } .uni-title__base { font-size: 15px; color: #333; font-weight: 500; } .uni-h1 { font-size: 20px; color: #333; font-weight: bold; } .uni-h2 { font-size: 18px; color: #333; font-weight: bold; } .uni-h3 { font-size: 16px; color: #333; font-weight: bold; /* font-weight: 400; */ } .uni-h4 { font-size: 14px; color: #333; font-weight: bold; /* font-weight: 300; */ } .uni-h5 { font-size: 12px; color: #333; font-weight: bold; /* font-weight: 200; */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-title/components/uni-title/uni-title.vue
Vue
unknown
3,256
<template> <view class="uni-tooltip"> <slot></slot> <view v-if="content || $slots.content" class="uni-tooltip-popup" :style="initPlacement"> <slot name="content"> {{content}} </slot> </view> </view> </template> <script> /** * Tooltip 提示文字 * @description 常用于展示鼠标 hover 时的提示信息。 * @tutorial https://uniapp.dcloud.io/component/uniui/uni-tooltip * @property {String} content 弹出层显示的内容 * @property {String} placement出现位置, 目前支持:left right top bottom */ export default { name: "uni-tooltip", data() { return { }; }, methods: {}, computed: { initPlacement() { let style = {}; switch (this.placement) { case 'left': style = { top: '50%', transform: 'translateY(-50%)', right: '100%', "margin-right": '10rpx', } break; case 'right': style = { top: '50%', transform: 'translateY(-50%)', left: '100%', "margin-left": '10rpx', } break; case 'top': style = { bottom: '100%', transform: 'translateX(-50%)', left: '50%', "margin-bottom": '10rpx', } break; case 'bottom': style = { top: '100%', transform: 'translateX(-50%)', left: '50%', "margin-top": '10rpx', } break; } return Object.entries(style).map(([key, value]) => `${key}: ${value}`).join('; '); } }, props: { content: { type: String, default: '' }, placement: { type: String, default: 'bottom' }, } } </script> <style> .uni-tooltip { position: relative; cursor: pointer; display: inline-block; } .uni-tooltip-popup { z-index: 1; display: none; position: absolute; background-color: #333; border-radius: 8px; color: #fff; font-size: 12px; text-align: left; line-height: 16px; padding: 12px; overflow: auto; } .uni-tooltip:hover .uni-tooltip-popup { display: block; } </style>
2301_77169380/AppruanjianApk
uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue
Vue
unknown
2,044
// const defaultOption = { // duration: 300, // timingFunction: 'linear', // delay: 0, // transformOrigin: '50% 50% 0' // } // #ifdef APP-NVUE const nvueAnimation = uni.requireNativePlugin('animation') // #endif class MPAnimation { constructor(options, _this) { this.options = options // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误 this.animation = uni.createAnimation({ ...options }) this.currentStepAnimates = {} this.next = 0 this.$ = _this } _nvuePushAnimates(type, args) { let aniObj = this.currentStepAnimates[this.next] let styles = {} if (!aniObj) { styles = { styles: {}, config: {} } } else { styles = aniObj } if (animateTypes1.includes(type)) { if (!styles.styles.transform) { styles.styles.transform = '' } let unit = '' if(type === 'rotate'){ unit = 'deg' } styles.styles.transform += `${type}(${args+unit}) ` } else { styles.styles[type] = `${args}` } this.currentStepAnimates[this.next] = styles } _animateRun(styles = {}, config = {}) { let ref = this.$.$refs['ani'].ref if (!ref) return return new Promise((resolve, reject) => { nvueAnimation.transition(ref, { styles, ...config }, res => { resolve() }) }) } _nvueNextAnimate(animates, step = 0, fn) { let obj = animates[step] if (obj) { let { styles, config } = obj this._animateRun(styles, config).then(() => { step += 1 this._nvueNextAnimate(animates, step, fn) }) } else { this.currentStepAnimates = {} typeof fn === 'function' && fn() this.isEnd = true } } step(config = {}) { // #ifndef APP-NVUE this.animation.step(config) // #endif // #ifdef APP-NVUE this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin this.next++ // #endif return this } run(fn) { // #ifndef APP-NVUE this.$.animationData = this.animation.export() this.$.timer = setTimeout(() => { typeof fn === 'function' && fn() }, this.$.durationTime) // #endif // #ifdef APP-NVUE this.isEnd = false let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref if(!ref) return this._nvueNextAnimate(this.currentStepAnimates, 0, fn) this.next = 0 // #endif } } const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', 'translateZ' ] const animateTypes2 = ['opacity', 'backgroundColor'] const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { MPAnimation.prototype[type] = function(...args) { // #ifndef APP-NVUE this.animation[type](...args) // #endif // #ifdef APP-NVUE this._nvuePushAnimates(type, args) // #endif return this } }) export function createAnimation(option, _this) { if(!_this) return clearTimeout(_this.timer) return new MPAnimation(option, _this) }
2301_77169380/AppruanjianApk
uni_modules/uni-transition/components/uni-transition/createAnimation.js
JavaScript
unknown
3,281
<template> <!-- #ifndef APP-NVUE --> <view v-show="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view> <!-- #endif --> <!-- #ifdef APP-NVUE --> <view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view> <!-- #endif --> </template> <script> import { createAnimation } from './createAnimation' /** * Transition 过渡动画 * @description 简单过渡动画组件 * @tutorial https://ext.dcloud.net.cn/plugin?id=985 * @property {Boolean} show = [false|true] 控制组件显示或隐藏 * @property {Array|String} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型 * @value fade 渐隐渐出过渡 * @value slide-top 由上至下过渡 * @value slide-right 由右至左过渡 * @value slide-bottom 由下至上过渡 * @value slide-left 由左至右过渡 * @value zoom-in 由小到大过渡 * @value zoom-out 由大到小过渡 * @property {Number} duration 过渡动画持续时间 * @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red` */ export default { name: 'uniTransition', emits:['click','change'], props: { show: { type: Boolean, default: false }, modeClass: { type: [Array, String], default() { return 'fade' } }, duration: { type: Number, default: 300 }, styles: { type: Object, default() { return {} } }, customClass:{ type: String, default: '' }, onceRender:{ type:Boolean, default:false }, }, data() { return { isShow: false, transform: '', opacity: 1, animationData: {}, durationTime: 300, config: {} } }, watch: { show: { handler(newVal) { if (newVal) { this.open() } else { // 避免上来就执行 close,导致动画错乱 if (this.isShow) { this.close() } } }, immediate: true } }, computed: { // 生成样式数据 stylesObject() { let styles = { ...this.styles, 'transition-duration': this.duration / 1000 + 's' } let transform = '' for (let i in styles) { let line = this.toLine(i) transform += line + ':' + styles[i] + ';' } return transform }, // 初始化动画条件 transformStyles() { return 'transform:' + this.transform + ';' + 'opacity:' + this.opacity + ';' + this.stylesObject } }, created() { // 动画默认配置 this.config = { duration: this.duration, timingFunction: 'ease', transformOrigin: '50% 50%', delay: 0 } this.durationTime = this.duration }, methods: { /** * ref 触发 初始化动画 */ init(obj = {}) { if (obj.duration) { this.durationTime = obj.duration } this.animation = createAnimation(Object.assign(this.config, obj),this) }, /** * 点击组件触发回调 */ onClick() { this.$emit('click', { detail: this.isShow }) }, /** * ref 触发 动画分组 * @param {Object} obj */ step(obj, config = {}) { if (!this.animation) return for (let i in obj) { try { if(typeof obj[i] === 'object'){ this.animation[i](...obj[i]) }else{ this.animation[i](obj[i]) } } catch (e) { console.error(`方法 ${i} 不存在`) } } this.animation.step(config) return this }, /** * ref 触发 执行动画 */ run(fn) { if (!this.animation) return this.animation.run(fn) }, // 开始过度动画 open() { clearTimeout(this.timer) this.transform = '' this.isShow = true let { opacity, transform } = this.styleInit(false) if (typeof opacity !== 'undefined') { this.opacity = opacity } this.transform = transform // 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常 this.$nextTick(() => { // TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器 this.timer = setTimeout(() => { this.animation = createAnimation(this.config, this) this.tranfromInit(false).step() this.animation.run() this.$emit('change', { detail: this.isShow }) }, 20) }) }, // 关闭过度动画 close(type) { if (!this.animation) return this.tranfromInit(true) .step() .run(() => { this.isShow = false this.animationData = null this.animation = null let { opacity, transform } = this.styleInit(false) this.opacity = opacity || 1 this.transform = transform this.$emit('change', { detail: this.isShow }) }) }, // 处理动画开始前的默认样式 styleInit(type) { let styles = { transform: '' } let buildStyle = (type, mode) => { if (mode === 'fade') { styles.opacity = this.animationType(type)[mode] } else { styles.transform += this.animationType(type)[mode] + ' ' } } if (typeof this.modeClass === 'string') { buildStyle(type, this.modeClass) } else { this.modeClass.forEach(mode => { buildStyle(type, mode) }) } return styles }, // 处理内置组合动画 tranfromInit(type) { let buildTranfrom = (type, mode) => { let aniNum = null if (mode === 'fade') { aniNum = type ? 0 : 1 } else { aniNum = type ? '-100%' : '0' if (mode === 'zoom-in') { aniNum = type ? 0.8 : 1 } if (mode === 'zoom-out') { aniNum = type ? 1.2 : 1 } if (mode === 'slide-right') { aniNum = type ? '100%' : '0' } if (mode === 'slide-bottom') { aniNum = type ? '100%' : '0' } } this.animation[this.animationMode()[mode]](aniNum) } if (typeof this.modeClass === 'string') { buildTranfrom(type, this.modeClass) } else { this.modeClass.forEach(mode => { buildTranfrom(type, mode) }) } return this.animation }, animationType(type) { return { fade: type ? 0 : 1, 'slide-top': `translateY(${type ? '0' : '-100%'})`, 'slide-right': `translateX(${type ? '0' : '100%'})`, 'slide-bottom': `translateY(${type ? '0' : '100%'})`, 'slide-left': `translateX(${type ? '0' : '-100%'})`, 'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`, 'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})` } }, // 内置动画类型与实际动画对应字典 animationMode() { return { fade: 'opacity', 'slide-top': 'translateY', 'slide-right': 'translateX', 'slide-bottom': 'translateY', 'slide-left': 'translateX', 'zoom-in': 'scale', 'zoom-out': 'scale' } }, // 驼峰转中横线 toLine(name) { return name.replace(/([A-Z])/g, '-$1').toLowerCase() } } } </script> <style></style>
2301_77169380/AppruanjianApk
uni_modules/uni-transition/components/uni-transition/uni-transition.vue
Vue
unknown
6,903
<template> <view>占位组件,请勿使用</view> </template> <script> </script> <style> </style>
2301_77169380/AppruanjianApk
uni_modules/uni-ui/components/uni-ui/uni-ui.vue
Vue
unknown
101
export default { props: { // 标题,有值则显示,同时会显示关闭按钮 title: { type: String, default: '' }, // 选项上方的描述信息 description: { type: String, default: '' }, // 数据 actions: { type: Array, default: () => [] }, // 取消按钮的文字,不为空时显示按钮 cancelText: { type: String, default: '' }, // 点击某个菜单项时是否关闭弹窗 closeOnClickAction: { type: Boolean, default: true }, // 处理底部安全区(默认true) safeAreaInsetBottom: { type: Boolean, default: true }, // 小程序的打开方式 openType: { type: String, default: '' }, // 点击遮罩是否允许关闭 (默认true) closeOnClickOverlay: { type: Boolean, default: true }, // 圆角值 round: { type: [Boolean, String, Number], default: 0 }, ...uni.$uv?.props?.actionSheet } }
2301_77169380/AppruanjianApk
uni_modules/uv-action-sheet/components/uv-action-sheet/props.js
JavaScript
unknown
929
<template> <uv-popup ref="popup" mode="bottom" :safeAreaInsetBottom="safeAreaInsetBottom" :round="round" :close-on-click-overlay="closeOnClickOverlay" @change="popupChange" > <view class="uv-action-sheet"> <view class="uv-action-sheet__header" v-if="title" > <text class="uv-action-sheet__header__title uv-line-1">{{title}}</text> <view class="uv-action-sheet__header__icon-wrap" @tap.stop="cancel" > <uv-icon name="close" size="17" color="#c8c9cc" bold ></uv-icon> </view> </view> <text class="uv-action-sheet__description" :style="[{ marginTop: `${title && description ? 0 : '18px'}` }]" v-if="description" >{{description}}</text> <slot> <uv-line v-if="description"></uv-line> <view class="uv-action-sheet__item-wrap"> <view v-for="(item, index) in actions" :key="index"> <!-- #ifdef MP --> <button class="uv-reset-button" :openType="item.openType" @getuserinfo="onGetUserInfo" @contact="onContact" @getphonenumber="onGetPhoneNumber" @error="onError" @launchapp="onLaunchApp" @opensetting="onOpenSetting" :lang="lang" :session-from="sessionFrom" :send-message-title="sendMessageTitle" :send-message-path="sendMessagePath" :send-message-img="sendMessageImg" :show-message-card="showMessageCard" :app-parameter="appParameter" @tap="selectHandler(index)" :hover-class="!item.disabled && !item.loading ? 'uv-action-sheet--hover' : ''" > <!-- #endif --> <view class="uv-action-sheet__item-wrap__item" @tap.stop="selectHandler(index)" :hover-class="!item.disabled && !item.loading ? 'uv-action-sheet--hover' : ''" :hover-stay-time="150" > <template v-if="!item.loading"> <text class="uv-action-sheet__item-wrap__item__name" :style="[itemStyle(index)]" >{{ item.name }}</text> <text v-if="item.subname" class="uv-action-sheet__item-wrap__item__subname" >{{ item.subname }}</text> </template> <uv-loading-icon v-else custom-class="van-action-sheet__loading" size="18" mode="circle" /> </view> <!-- #ifdef MP --> </button> <!-- #endif --> <uv-line v-if="index !== actions.length - 1"></uv-line> </view> </view> </slot> <uv-gap bgColor="#eaeaec" height="6" v-if="cancelText" ></uv-gap> <view hover-class="uv-action-sheet--hover"> <text @touchmove.stop.prevent :hover-stay-time="150" v-if="cancelText" class="uv-action-sheet__cancel-text" @tap="cancel" >{{cancelText}}</text> </view> </view> </uv-popup> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import button from '@/uni_modules/uv-ui-tools/libs/mixin/button.js' import openType from '@/uni_modules/uv-ui-tools/libs/mixin/openType.js' import props from './props.js'; /** * ActionSheet 操作菜单 * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。 * @tutorial https://www.uvui.cn/components/actionSheet.html * @property {Boolean} show 操作菜单是否展示 (默认 false ) * @property {String} title 操作菜单标题 * @property {String} description 选项上方的描述信息 * @property {Array<Object>} actions 按钮的文字数组,见官方文档示例 * @property {String} cancelText 取消按钮的提示文字,不为空时显示按钮 * @property {Boolean} closeOnClickAction 点击某个菜单项时是否关闭弹窗 (默认 true ) * @property {Boolean} safeAreaInsetBottom 处理底部安全区 (默认 true ) * @property {String} openType 小程序的打开方式 (contact | launchApp | getUserInfo | openSetting |getPhoneNumber |error ) * @property {Boolean} closeOnClickOverlay 点击遮罩是否允许关闭 (默认 true ) * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文 * @property {String} sessionFrom 会话来源,openType="contact"时有效 * @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效 * @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 * @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效 * @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 (默认 false ) * @property {String} appParameter 打开 APP 时,向 APP 传递的参数,openType=launchApp 时有效 * * @event {Function} select 点击ActionSheet列表项时触发 * @event {Function} close 点击取消按钮时触发 * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 wx.getUserInfo 返回的一致,openType="getUserInfo"时有效 * @event {Function} contact 客服消息回调,openType="contact"时有效 * @event {Function} getphonenumber 获取用户手机号回调,openType="getPhoneNumber"时有效 * @event {Function} error 当使用开放能力时,发生错误的回调,openType="error"时有效 * @event {Function} launchapp 打开 APP 成功的回调,openType="launchApp"时有效 * @event {Function} opensetting 在打开授权设置页后回调,openType="openSetting"时有效 * @example <uv-action-sheet ref="actionSheet" :actions="list" :title="title" ></uv-action-sheet> */ export default { name: "uv-action-sheet", mixins: [openType, button, mpMixin , mixin, props], emits: ['close', 'select'], computed: { // 操作项目的样式 itemStyle() { return (index) => { let style = {}; if (this.actions[index].color) style.color = this.actions[index].color if (this.actions[index].fontSize) style.fontSize = this.$uv.addUnit(this.actions[index].fontSize) // 选项被禁用的样式 if (this.actions[index].disabled) style.color = '#c0c4cc' return style; } }, }, methods: { open() { this.$refs.popup.open(); }, close() { this.$refs.popup.close(); }, popupChange(e) { if(!e.show) this.$emit('close'); }, // 点击取消按钮 cancel() { this.close(); }, selectHandler(index) { const item = this.actions[index] if (item && !item.disabled && !item.loading) { this.$emit('select', item) if (this.closeOnClickAction) { this.close(); } } }, } } </script> <style lang="scss" scoped> $show-lines: 1; $show-reset-button: 1; @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; $uv-action-sheet-reset-button-width:100% !default; $uv-action-sheet-title-font-size: 16px !default; $uv-action-sheet-title-padding: 12px 30px !default; $uv-action-sheet-title-color: $uv-main-color !default; $uv-action-sheet-header-icon-wrap-right:15px !default; $uv-action-sheet-header-icon-wrap-top:15px !default; $uv-action-sheet-description-font-size:13px !default; $uv-action-sheet-description-color:14px !default; $uv-action-sheet-description-margin: 18px 15px !default; $uv-action-sheet-item-wrap-item-padding:15px !default; $uv-action-sheet-item-wrap-name-font-size:16px !default; $uv-action-sheet-item-wrap-subname-font-size:13px !default; $uv-action-sheet-item-wrap-subname-color: #c0c4cc !default; $uv-action-sheet-item-wrap-subname-margin-top:10px !default; $uv-action-sheet-cancel-text-font-size:16px !default; $uv-action-sheet-cancel-text-color:$uv-content-color !default; $uv-action-sheet-cancel-text-font-size:15px !default; $uv-action-sheet-cancel-text-hover-background-color:rgb(242, 243, 245) !default; .uv-reset-button { width: $uv-action-sheet-reset-button-width; } .uv-action-sheet { text-align: center; &__header { position: relative; padding: $uv-action-sheet-title-padding; &__title { font-size: $uv-action-sheet-title-font-size; color: $uv-action-sheet-title-color; font-weight: bold; text-align: center; } &__icon-wrap { position: absolute; right: $uv-action-sheet-header-icon-wrap-right; top: $uv-action-sheet-header-icon-wrap-top; } } &__description { font-size: $uv-action-sheet-description-font-size; color: $uv-tips-color; margin: $uv-action-sheet-description-margin; text-align: center; } &__item-wrap { &__item { padding: $uv-action-sheet-item-wrap-item-padding; @include flex; align-items: center; justify-content: center; flex-direction: column; &__name { font-size: $uv-action-sheet-item-wrap-name-font-size; color: $uv-main-color; text-align: center; } &__subname { font-size: $uv-action-sheet-item-wrap-subname-font-size; color: $uv-action-sheet-item-wrap-subname-color; margin-top: $uv-action-sheet-item-wrap-subname-margin-top; text-align: center; } } } &__cancel-text { font-size: $uv-action-sheet-cancel-text-font-size; color: $uv-action-sheet-cancel-text-color; text-align: center; padding: $uv-action-sheet-cancel-text-font-size; } &--hover { background-color: $uv-action-sheet-cancel-text-hover-background-color; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-action-sheet/components/uv-action-sheet/uv-action-sheet.vue
Vue
unknown
10,036
<template> <view class="uv-album"> <view class="uv-album__row" ref="uv-album__row" v-for="(arr, index) in showUrls" :forComputedUse="albumWidth" :key="index" > <view class="uv-album__row__wrapper" v-for="(item, index1) in arr" :key="index1" :style="[imageStyle(index + 1, index1 + 1)]" @tap.stop="previewFullImage ? onPreviewTap(getSrc(item)) : ''" > <image :src="getSrc(item)" :mode=" urls.length === 1 ? imageHeight > 0 ? singleMode : 'widthFix' : multipleMode " :style="[ { width: imageWidth, height: imageHeight } ]" ></image> <view v-if=" showMore && urls.length > rowCount * showUrls.length && index === showUrls.length - 1 && index1 === showUrls[showUrls.length - 1].length - 1 " class="uv-album__row__wrapper__text" > <uv-text :text="`+${urls.length - maxCount}`" color="#fff" :size="$uv.getPx(multipleSize) * 0.3" align="center" customStyle="justify-content: center" ></uv-text> </view> </view> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' // #ifdef APP-NVUE // 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度 const dom = uni.requireNativePlugin('dom') // #endif /** * Album 相册 * @description 本组件提供一个类似相册的功能,让开发者开发起来更加得心应手。减少重复的模板代码 * @tutorial https://www.uvui.cn/components/album.html * @property {Array} urls 图片地址列表 Array<String>|Array<Object>形式 * @property {String} keyName 指定从数组的对象元素中读取哪个属性作为图片地址 * @property {String | Number} singleSize 单图时,图片长边的长度 (默认 180 ) * @property {String | Number} multipleSize 多图时,图片边长 (默认 70 ) * @property {String | Number} space 多图时,图片水平和垂直之间的间隔 (默认 6 ) * @property {String} singleMode 单图时,图片缩放裁剪的模式 (默认 'scaleToFill' ) * @property {String} multipleMode 多图时,图片缩放裁剪的模式 (默认 'aspectFill' ) * @property {String | Number} maxCount 取消按钮的提示文字 (默认 9 ) * @property {Boolean} previewFullImage 是否可以预览图片 (默认 true ) * @property {String | Number} rowCount 每行展示图片数量,如设置,singleSize和multipleSize将会无效 (默认 3 ) * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true ) * * @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width ) * @example <uv-album :urls="urls2" @albumWidth="width => albumWidth = width" multipleSize="68" ></uv-album> */ export default { name: 'uv-album', mixins: [mpMixin, mixin], emits: ['albumWidth'], props: { // 图片地址,Array<String>|Array<Object>形式 urls: { type: Array, default: () => [] }, // 指定从数组的对象元素中读取哪个属性作为图片地址 keyName: { type: String, default: '' }, // 单图时,图片长边的长度 singleSize: { type: [String, Number], default: 180 }, // 多图时,图片边长 multipleSize: { type: [String, Number], default: 70 }, // 多图时,图片水平和垂直之间的间隔 space: { type: [String, Number], default: 6 }, // 单图时,图片缩放裁剪的模式 singleMode: { type: String, default: 'scaleToFill' }, // 多图时,图片缩放裁剪的模式 multipleMode: { type: String, default: 'aspectFill' }, // 最多展示的图片数量,超出时最后一个位置将会显示剩余图片数量 maxCount: { type: [String, Number], default: 9 }, // 是否可以预览图片 previewFullImage: { type: Boolean, default: true }, // 每行展示图片数量,如设置,singleSize和multipleSize将会无效 rowCount: { type: [String, Number], default: 3 }, // 超出maxCount时是否显示查看更多的提示 showMore: { type: Boolean, default: true }, ...uni.$uv?.props?.album }, data() { return { // 单图的宽度 singleWidth: 0, // 单图的高度 singleHeight: 0, // 单图时,如果无法获取图片的尺寸信息,让图片宽度默认为容器的一定百分比 singlePercent: 0.6 } }, watch: { urls: { immediate: true, handler(newVal) { if (newVal.length === 1) { this.getImageRect() } } } }, computed: { imageStyle() { return (index1, index2) => { const { space, rowCount, multipleSize, urls } = this; const rowLen = this.showUrls.length; const allLen = this.urls.length; const style = { marginRight: this.$uv.addUnit(space), marginBottom: this.$uv.addUnit(space) } // 如果为最后一行,则每个图片都无需下边框 if (index1 === rowLen) style.marginBottom = 0 // 每行的最右边一张和总长度的最后一张无需右边框 if ( index2 === rowCount || (index1 === rowLen && index2 === this.showUrls[index1 - 1].length) ) style.marginRight = 0 return style } }, // 将数组划分为二维数组 showUrls() { const arr = [] this.urls.map((item, index) => { // 限制最大展示数量 if (index + 1 <= this.maxCount) { // 计算该元素为第几个素组内 const itemIndex = Math.floor(index / this.rowCount) // 判断对应的索引是否存在 if (!arr[itemIndex]) { arr[itemIndex] = [] } arr[itemIndex].push(item) } }) return arr }, imageWidth() { return this.$uv.addUnit( this.urls.length === 1 ? this.singleWidth : this.multipleSize ) }, imageHeight() { return this.$uv.addUnit( this.urls.length === 1 ? this.singleHeight : this.multipleSize ) }, // 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度 // 因为用户在某些特殊的情况下,需要让文字与相册的宽度相等,所以这里事件的形式对外发送 albumWidth() { let width = 0 if (this.urls.length === 1) { width = this.singleWidth } else { width = this.showUrls[0].length * this.$uv.getPx(this.multipleSize) + this.$uv.getPx(this.space) * (this.showUrls[0].length - 1) } this.$emit('albumWidth', width) return width } }, methods: { // 预览图片 onPreviewTap(url) { const urls = this.urls.map((item) => { return this.getSrc(item) }) uni.previewImage({ current: url, urls }) }, // 获取图片的路径 getSrc(item) { return this.$uv.test.object(item) ? (this.keyName && item[this.keyName]) || item.src : item }, // 单图时,获取图片的尺寸 // 在小程序中,需要将网络图片的的域名添加到小程序的download域名才可能获取尺寸 // 在没有添加的情况下,让单图宽度默认为盒子的一定宽度(singlePercent) getImageRect() { const src = this.getSrc(this.urls[0]) uni.getImageInfo({ src, success: (res) => { // 判断图片横向还是竖向展示方式 const isHorizotal = res.width >= res.height this.singleWidth = isHorizotal ? this.singleSize : (res.width / res.height) * this.$uv.getPx(this.singleSize) this.singleHeight = !isHorizotal ? this.singleSize : (res.height / res.width) * this.singleWidth }, fail: () => { this.getComponentWidth() } }) }, // 获取组件的宽度 async getComponentWidth() { // 延时一定时间,以获取dom尺寸 await this.$uv.sleep(30) // #ifndef APP-NVUE this.$uGetRect('.uv-album__row').then((size) => { this.singleWidth = size.width * this.singlePercent }) // #endif // #ifdef APP-NVUE // 这里ref="uv-album__row"所在的标签为通过for循环出来,导致this.$refs['uv-album__row']是一个数组 const ref = this.$refs['uv-album__row'][0] ref && dom.getComponentRect(ref, (res) => { this.singleWidth = res.size.width * this.singlePercent }) // #endif } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; .uv-album { @include flex(column); &__row { @include flex(row); flex-wrap: wrap; &__wrapper { position: relative; &__text { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.3); @include flex(row); justify-content: center; align-items: center; } } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-album/components/uv-album/uv-album.vue
Vue
unknown
9,598
export default { props: { // 显示文字 title: { type: String, default: '' }, // 主题,success/warning/info/error type: { type: String, default: 'warning' }, // 辅助性文字 description: { type: String, default: '' }, // 是否可关闭 closable: { type: Boolean, default: false }, // 是否显示图标 showIcon: { type: Boolean, default: false }, // 浅或深色调,light-浅色,dark-深色 effect: { type: String, default: 'light' }, // 文字是否居中 center: { type: Boolean, default: false }, // 字体大小 fontSize: { type: [String, Number], default: 14 }, ...uni.$uv?.props?.alert } }
2301_77169380/AppruanjianApk
uni_modules/uv-alert/components/uv-alert/props.js
JavaScript
unknown
709
<template> <uv-transition mode="fade" :show="show" > <view class="uv-alert" :class="[`uv-alert--${type}--${effect}`]" @tap.stop="clickHandler" :style="[$uv.addStyle(customStyle)]" > <view class="uv-alert__icon" v-if="showIcon" > <uv-icon :name="iconName" size="18" :color="iconColor" ></uv-icon> </view> <view class="uv-alert__content" :style="[{ paddingRight: closable ? '20px' : 0 }]" > <text class="uv-alert__content__title" v-if="title" :style="[{ fontSize: $uv.addUnit(fontSize), textAlign: center ? 'center' : 'left' }]" :class="[effect === 'dark' ? 'uv-alert__text--dark' : `uv-alert__text--${type}--light`]" >{{ title }}</text> <text class="uv-alert__content__desc" v-if="description" :style="[{ fontSize: $uv.addUnit(fontSize), textAlign: center ? 'center' : 'left' }]" :class="[effect === 'dark' ? 'uv-alert__text--dark' : `uv-alert__text--${type}--light`]" >{{ description }}</text> </view> <view class="uv-alert__close" v-if="closable" @tap.stop="closeHandler" > <uv-icon name="close" :color="iconColor" size="15" ></uv-icon> </view> </view> </uv-transition> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * Alert 警告提示 * @description 警告提示,展现需要关注的信息。 * @tutorial https://www.uvui.cn/components/alertTips.html * * @property {String} title 显示的文字 * @property {String} type 使用预设的颜色 (默认 'warning' ) * @property {String} description 辅助性文字,颜色比title浅一点,字号也小一点,可选 * @property {Boolean} closable 关闭按钮(默认为叉号icon图标) (默认 false ) * @property {Boolean} showIcon 是否显示左边的辅助图标 ( 默认 false ) * @property {String} effect 多图时,图片缩放裁剪的模式 (默认 'light' ) * @property {Boolean} center 文字是否居中 (默认 false ) * @property {String | Number} fontSize 字体大小 (默认 14 ) * @property {Object} customStyle 定义需要用到的外部样式 * @event {Function} click 点击组件时触发 * @example <uv-alert :title="title" type = "warning" :closable="closable" :description = "description"></uv-alert> */ export default { name: 'uv-alert', mixins: [mpMixin, mixin, props], emits: ['click'], data() { return { show: true } }, computed: { iconColor() { return this.effect === 'light' ? this.type : '#fff' }, // 不同主题对应不同的图标 iconName() { switch (this.type) { case 'success': return 'checkmark-circle-fill'; break; case 'error': return 'close-circle-fill'; break; case 'warning': return 'error-circle-fill'; break; case 'info': return 'info-circle-fill'; break; case 'primary': return 'more-circle-fill'; break; default: return 'error-circle-fill'; } } }, methods: { // 点击内容 clickHandler() { this.$emit('click') }, // 点击关闭按钮 closeHandler() { this.show = false } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; .uv-alert { position: relative; background-color: $uv-primary; padding: 8px 10px; @include flex(row); align-items: center; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; &--primary--dark { background-color: $uv-primary; } &--primary--light { background-color: #ecf5ff; } &--error--dark { background-color: $uv-error; } &--error--light { background-color: #FEF0F0; } &--success--dark { background-color: $uv-success; } &--success--light { background-color: #f5fff0; } &--warning--dark { background-color: $uv-warning; } &--warning--light { background-color: #FDF6EC; } &--info--dark { background-color: $uv-info; } &--info--light { background-color: #f4f4f5; } &__icon { margin-right: 5px; } &__content { @include flex(column); flex: 1; &__title { color: $uv-main-color; font-size: 14px; font-weight: bold; color: #fff; margin-bottom: 2px; } &__desc { color: $uv-main-color; font-size: 14px; flex-wrap: wrap; color: #fff; } } &__title--dark, &__desc--dark { color: #FFFFFF; } &__text--primary--light, &__text--primary--light { color: $uv-primary; } &__text--success--light, &__text--success--light { color: $uv-success; } &__text--warning--light, &__text--warning--light { color: $uv-warning; } &__text--error--light, &__text--error--light { color: $uv-error; } &__text--info--light, &__text--info--light { color: $uv-info; } &__close { position: absolute; top: 11px; right: 10px; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-alert/components/uv-alert/uv-alert.vue
Vue
unknown
5,421
import { range } from '@/uni_modules/uv-ui-tools/libs/function/test.js' export default { props: { // 头像图片路径(不能为相对路径) src: { type: String, default: '' }, // 头像形状,circle-圆形,square-方形 shape: { type: String, default: 'circle' }, // 头像尺寸 size: { type: [String, Number], default: 40 }, // 裁剪模式 mode: { type: String, default: 'scaleToFill' }, // 显示的文字 text: { type: String, default: '' }, // 背景色 bgColor: { type: String, default: '#c0c4cc' }, // 文字颜色 color: { type: String, default: '#fff' }, // 文字大小 fontSize: { type: [String, Number], default: 18 }, // 显示的图标 icon: { type: String, default: '' }, // 显示小程序头像,只对百度,微信,QQ小程序有效 mpAvatar: { type: Boolean, default: false }, // 是否使用随机背景色 randomBgColor: { type: Boolean, default: false }, // 加载失败的默认头像(组件有内置默认图片) defaultUrl: { type: String, default: '' }, // 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间 colorIndex: { type: [String, Number], // 校验参数规则,索引在0-19之间 validator(n) { return range(n, [0, 19]) || n === '' }, default: '' }, // 组件标识符 name: { type: String, default: '' }, ...uni.$uv?.props?.avatar } }
2301_77169380/AppruanjianApk
uni_modules/uv-avatar/components/uv-avatar/props.js
JavaScript
unknown
1,560
<template> <view class="uv-avatar" :class="[`uv-avatar--${shape}`]" :style="[{ backgroundColor: (text || icon) ? (randomBgColor ? colors[colorIndex !== '' ? colorIndex : $uv.random(0, 19)] : bgColor) : 'transparent', width: $uv.addUnit(size), height: $uv.addUnit(size), }, $uv.addStyle(customStyle)]" @tap="clickHandler" > <slot> <!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU --> <open-data v-if="mpAvatar && allowMp" type="userAvatarUrl" :style="[{ width: $uv.addUnit(size), height: $uv.addUnit(size) }]" /> <!-- #endif --> <!-- #ifndef MP-WEIXIN && MP-QQ && MP-BAIDU --> <template v-if="mpAvatar && allowMp"></template> <!-- #endif --> <uv-icon v-else-if="icon" :name="icon" :size="fontSize" :color="color" ></uv-icon> <uv-text v-else-if="text" :text="text" :size="fontSize" :color="color" align="center" customStyle="justify-content: center" ></uv-text> <image class="uv-avatar__image" v-else :class="[`uv-avatar__image--${shape}`]" :src="avatarUrl || defaultUrl" :mode="mode" @error="errorHandler" :style="[{ width: $uv.addUnit(size), height: $uv.addUnit(size) }]" ></image> </slot> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; const base64Avatar = "data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QMraHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzYgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjREMEQwRkY0RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjREMEQwRkY1RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NEQwRDBGRjJGODA0MTFFQTk5NjZEODE4Njc2QkU4MzEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NEQwRDBGRjNGODA0MTFFQTk5NjZEODE4Njc2QkU4MzEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7/7gAOQWRvYmUAZMAAAAAB/9sAhAAGBAQEBQQGBQUGCQYFBgkLCAYGCAsMCgoLCgoMEAwMDAwMDBAMDg8QDw4MExMUFBMTHBsbGxwfHx8fHx8fHx8fAQcHBw0MDRgQEBgaFREVGh8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx//wAARCADIAMgDAREAAhEBAxEB/8QAcQABAQEAAwEBAAAAAAAAAAAAAAUEAQMGAgcBAQAAAAAAAAAAAAAAAAAAAAAQAAIBAwICBgkDBQAAAAAAAAABAhEDBCEFMVFBYXGREiKBscHRMkJSEyOh4XLxYjNDFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A/fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHbHFyZ/Dam+yLA+Z2L0Pjtyj2poD4AAAAAAAAAAAAAAAAAAAAAAAAKWFs9y6lcvvwQeqj8z9wFaziY1n/HbUX9XF97A7QAGXI23EvJ1goyfzR0YEfN269jeZ+a03pNe0DIAAAAAAAAAAAAAAAAAAAACvtO3RcVkXlWutuL9YFYAAAAAOJRjKLjJVi9GmB5/csH/mu1h/in8PU+QGMAAAAAAAAAAAAAAAAAAaMDG/6MmMH8C80+xAelSSVFolwQAAAAAAAHVlWI37ErUulaPk+hgeYnCUJuElSUXRrrQHAAAAAAAAAAAAAAAAABa2Oz4bM7r4zdF2ICmAAAAAAAAAg7zZ8GX41wuJP0rRgYAAAAAAAAAAAAAAAAAD0m2R8ODaXU33tsDSAAAAAAAAAlb9HyWZcnJd9PcBHAAAAAAAAAAAAAAAAAPS7e64Vn+KA0AAAAAAAAAJm+v8Ftf3ewCKAAAAAAAAAAAAAAAAAX9muqeGo9NttP06+0DcAAAAAAAAAjb7dTu2ra+VOT9P8AQCWAAAAAAAAAAAAAAAAAUNmyPt5Ltv4bui/kuAF0AAAAAAADiUlGLlJ0SVW+oDzOXfd/Ind6JPRdS0QHSAAAAAAAAAAAAAAAAAE2nVaNcGB6Lbs6OTao9LsF51z60BrAAAAAABJ3jOVHjW3r/sa9QEgAAAAAAAAAAAAAAAAAAAPu1duWriuW34ZR4MC9hbnZyEoy8l36XwfYBsAAADaSq9EuLAlZ+7xSdrGdW9Hc5dgEdtt1erfFgAAAAAAAAAAAAAAAAADVjbblX6NR8MH80tEBRs7HYivyzlN8lovaBPzduvY0m6eK10TXtAyAarO55lpJK54orolr+4GqO/Xaea1FvqbXvA+Z77kNeW3GPbV+4DJfzcm/pcm3H6Vou5AdAFLC2ed2Pjv1txa8sV8T6wOL+yZEKu1JXFy4MDBOE4ScZxcZLinoB8gAAAAAAAAAAAB242LeyJ+C3GvN9C7QLmJtePYpKS+5c+p8F2IDYAANJqj1T4oCfk7Nj3G5Wn9qXJax7gJ93Z82D8sVNc4v30A6Xg5i42Z+iLfqARwcyT0sz9MWvWBps7LlTf5Grce9/oBTxdtxseklHxT+uWr9AGoAB138ezfj4bsFJdD6V2MCPm7RdtJzs1uW1xXzL3gTgAAAAAAAAADRhYc8q74I6RWs5ckB6GxYtWLat21SK731sDsAAAAAAAAAAAAAAAASt021NO/YjrxuQXT1oCOAAAAAAABzGLlJRSq26JAelwsWONYjbXxcZvmwO8AAAAAAAAAAAAAAAAAAef3TEWPkVivx3NY9T6UBiAAAAAABo2+VmGXblddIJ8eivRUD0oAAAAAAAAAAAAAAAAAAAYt4tKeFKVNYNSXfRgefAAAAAAAAr7VuSSWPedKaW5v1MCsAAAAAAAAAAAAAAAAAAIe6bj96Ts2n+JPzSXzP3ATgAAAAAAAAFbbt1UUrOQ9FpC4/UwK6aaqtU+DAAAAAAAAAAAAAAA4lKMIuUmoxWrb4ARNx3R3q2rLpa4Sl0y/YCcAAAAAAAAAAANmFud7G8r89r6X0dgFvGzLGRGtuWvTF6NAdwAAAAAAAAAAAy5W442PVN+K59EePp5ARMvOv5MvO6QXCC4AZwAAAAAAAAAAAAAcxlKLUotprg1owN+PvORborq+7Hnwl3gUbO74VzRydt8pKn68ANcJwmqwkpLmnUDkAAAAfNy9atqtyagut0AxXt5xIV8Fbj6lRd7Am5G65V6qUvtwfyx94GMAAAAAAAAAAAAAAAAAAAOU2nVOj5gdsc3LiqRvTpyqwOxbnnrhdfpSfrQB7pnv/AGvuS9gHXPMy5/Fem1yq0v0A6W29XqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z"; /** * Avatar 头像 * @description 本组件一般用于展示头像的地方,如个人中心,或者评论列表页的用户头像展示等场所。 * @tutorial https://www.uvui.cn/components/avatar.html * * @property {String} src 头像路径,如加载失败,将会显示默认头像(不能为相对路径) * @property {String} shape 头像形状 ( circle (默认) | square) * @property {String | Number} size 头像尺寸,可以为指定字符串(large, default, mini),或者数值 (默认 40 ) * @property {String} mode 头像图片的裁剪类型,与uni的image组件的mode参数一致,如效果达不到需求,可尝试传widthFix值 (默认 'scaleToFill' ) * @property {String} text 用文字替代图片,级别优先于src * @property {String} bgColor 背景颜色,一般显示文字时用 (默认 '#c0c4cc' ) * @property {String} color 文字颜色 (默认 '#ffffff' ) * @property {String | Number} fontSize 文字大小 (默认 18 ) * @property {String} icon 显示的图标 * @property {Boolean} mpAvatar 显示小程序头像,只对百度,微信,QQ小程序有效 (默认 false ) * @property {Boolean} randomBgColor 是否使用随机背景色 (默认 false ) * @property {String} defaultUrl 加载失败的默认头像(组件有内置默认图片) * @property {String | Number} colorIndex 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间 * @property {String} name 组件标识符 (默认 'level' ) * @property {Object} customStyle 定义需要用到的外部样式 * * @event {Function} click 点击组件时触发 index: 用户传递的标识符 * @example <uv-avatar :src="src" mode="square"></uv-avatar> */ export default { name: 'uv-avatar', emits: ['click'], mixins: [mpMixin, mixin, props], data() { return { // 如果配置randomBgColor参数为true,在图标或者文字的模式下,会随机从中取出一个颜色值当做背景色 colors: ['#ffb34b', '#f2bba9', '#f7a196', '#f18080', '#88a867', '#bfbf39', '#89c152', '#94d554', '#f19ec2', '#afaae4', '#e1b0df', '#c38cc1', '#72dcdc', '#9acdcb', '#77b1cc', '#448aca', '#86cefa', '#98d1ee', '#73d1f1', '#80a7dc' ], avatarUrl: this.src, allowMp: false } }, watch: { // 监听头像src的变化,赋值给内部的avatarUrl变量,因为图片加载失败时,需要修改图片的src为默认值 // 而组件内部不能直接修改props的值,所以需要一个中间变量 src: { immediate: true, handler(newVal) { this.avatarUrl = newVal // 如果没有传src,则主动触发error事件,用于显示默认的头像,否则src为''空字符等的时候,会无内容展示 if(!newVal) { this.errorHandler() } } } }, computed: { imageStyle() { const style = {} return style } }, created() { this.init() }, methods: { init() { // 目前只有这几个小程序平台具有open-data标签 // 其他平台可以通过uni.getUserInfo类似接口获取信息,但是需要弹窗授权(首次),不合符组件逻辑 // 故目前自动获取小程序头像只支持这几个平台 // #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU this.allowMp = true // #endif }, // 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式 isImg() { return this.src.indexOf('/') !== -1 }, // 图片加载时失败时触发 errorHandler() { this.avatarUrl = this.defaultUrl || base64Avatar }, clickHandler() { this.$emit('click', this.name) } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; .uv-avatar { @include flex; align-items: center; justify-content: center; &--circle { border-radius: 100px; } &--square { border-radius: 4px; } &__image { &--circle { border-radius: 100px; } &--square { border-radius: 4px; } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue
Vue
unknown
9,279
export default { props: { // 头像图片组 urls: { type: Array, default: () => [] }, // 最多展示的头像数量 maxCount: { type: [String, Number], default: 5 }, // 头像形状 shape: { type: String, default: 'circle' }, // 图片裁剪模式 mode: { type: String, default: 'scaleToFill' }, // 超出maxCount时是否显示查看更多的提示 showMore: { type: Boolean, default: true }, // 头像大小 size: { type: [String, Number], default: 40 }, // 指定从数组的对象元素中读取哪个属性作为图片地址 keyName: { type: String, default: '' }, // 头像之间的遮挡比例 gap: { type: [String, Number], validator(value) { return value >= 0 && value <= 1 }, default: 0.5 }, // 需额外显示的值 extraValue: { type: [Number, String], default: 0 }, ...uni.$uv?.props?.avatarGroup } }
2301_77169380/AppruanjianApk
uni_modules/uv-avatar/components/uv-avatar-group/props.js
JavaScript
unknown
937
<template> <view class="uv-avatar-group"> <view class="uv-avatar-group__item" v-for="(item, index) in showUrl" :key="index" :style="{ marginLeft: index === 0 ? 0 : $uv.addUnit(-size * gap) }" > <uv-avatar :size="size" :shape="shape" :mode="mode" :src="$uv.test.object(item) ? keyName && item[keyName] || item.url : item" ></uv-avatar> <view class="uv-avatar-group__item__show-more" v-if="showMore && index === showUrl.length - 1 && (urls.length > maxCount || extraValue > 0)" @tap="clickHandler" > <uv-text color="#ffffff" :size="size * 0.4" :text="`+${extraValue || urls.length - showUrl.length}`" align="center" customStyle="justify-content: center" ></uv-text> </view> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * AvatarGroup 头像组 * @description 本组件一般用于展示头像的地方,如个人中心,或者评论列表页的用户头像展示等场所。 * @tutorial https://www.uvui.cn/components/avatar.html * * @property {Array} urls 头像图片组 (默认 [] ) * @property {String | Number} maxCount 最多展示的头像数量 ( 默认 5 ) * @property {String} shape 头像形状( 'circle' (默认) | 'square' ) * @property {String} mode 图片裁剪模式(默认 'scaleToFill' ) * @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true ) * @property {String | Number} size 头像大小 (默认 40 ) * @property {String} keyName 指定从数组的对象元素中读取哪个属性作为图片地址 * @property {String | Number} gap 头像之间的遮挡比例(0.4代表遮挡40%) (默认 0.5 ) * @property {String | Number} extraValue 需额外显示的值 * @event {Function} showMore 头像组更多点击 * @example <uv-avatar-group:urls="urls" size="35" gap="0.4" ></uv-avatar-group:urls=> */ export default { name: 'uv-avatar-group', mixins: [mpMixin, mixin, props], data() { return { } }, computed: { showUrl() { return this.urls.slice(0, this.maxCount) } }, methods: { clickHandler() { this.$emit('showMore') } }, } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; .uv-avatar-group { @include flex; &__item { margin-left: -10px; position: relative; &--no-indent { // 如果你想质疑作者不会使用:first-child,说明你太年轻,因为nvue不支持 margin-left: 0; } &__show-more { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-color: rgba(0, 0, 0, 0.3); @include flex; align-items: center; justify-content: center; border-radius: 100px; } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-avatar/components/uv-avatar-group/uv-avatar-group.vue
Vue
unknown
3,148
export default { props: { // 返回顶部的形状,circle-圆形,square-方形 mode: { type: String, default: 'circle' }, // 自定义图标 icon: { type: String, default: 'arrow-upward' }, // 提示文字 text: { type: String, default: '' }, // 返回顶部滚动时间 duration: { type: [String, Number], default: 100 }, // 滚动距离 scrollTop: { type: [String, Number], default: 0 }, // 距离顶部多少距离显示,单位px top: { type: [String, Number], default: 400 }, // 返回顶部按钮到底部的距离,单位px bottom: { type: [String, Number], default: 100 }, // 返回顶部按钮到右边的距离,单位px right: { type: [String, Number], default: 20 }, // 层级 zIndex: { type: [String, Number], default: 9 }, // 图标的样式,对象形式 iconStyle: { type: Object, default: () => ({ color: '#909399', fontSize: '19px' }) }, ...uni.$uv?.props?.backtop } }
2301_77169380/AppruanjianApk
uni_modules/uv-back-top/components/uv-back-top/props.js
JavaScript
unknown
1,029
<template> <uv-transition mode="fade" :customStyle="backTopStyle" :show="show"> <slot> <view class="uv-back-top" :style="[contentStyle]" @click="backToTop"> <uv-icon :name="icon" :custom-style="iconStyle"></uv-icon> <text v-if="text" class="uv-back-top__text">{{text}}</text> </view> </slot> </uv-transition> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; // #ifdef APP-NVUE const dom = weex.requireModule('dom') // #endif /** * backTop 返回顶部 * @description 本组件一个用于长页面,滑动一定距离后,出现返回顶部按钮,方便快速返回顶部的场景。 * @tutorial https://www.uvui.cn/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 <uv-back-top :scrollTop="scrollTop"></uv-back-top> */ export default { name: 'uv-back-top', emits: ['click'], mixins: [mpMixin, mixin, props], computed: { backTopStyle() { // 动画组件样式 const style = { bottom: this.$uv.addUnit(this.bottom), right: this.$uv.addUnit(this.right), width: '40px', height: '40px', position: 'fixed', zIndex: 10, } return style }, show() { return this.$uv.getPx(this.scrollTop) > this.$uv.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 this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle)) } }, methods: { backToTop() { // #ifdef APP-NVUE if (!this.$parent.$refs['uv-back-top']) { this.$uv.error(`nvue页面需要给页面最外层元素设置"ref='uv-back-top'`) } dom.scrollToElement(this.$parent.$refs['uv-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 '@/uni_modules/uv-ui-tools/libs/css/components.scss'; $uv-back-top-flex: 1 !default; $uv-back-top-height: 100% !default; $uv-back-top-background-color: #E1E1E1 !default; $uv-back-top-tips-font-size: 12px !default; .uv-back-top { @include flex; flex-direction: column; align-items: center; flex: $uv-back-top-flex; height: $uv-back-top-height; justify-content: center; background-color: $uv-back-top-background-color; &__tips { font-size: $uv-back-top-tips-font-size; transform: scale(0.8); } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-back-top/components/uv-back-top/uv-back-top.vue
Vue
unknown
3,844
export default { props: { // 是否显示圆点 isDot: { type: Boolean, default: false }, // 显示的内容 value: { type: [Number, String], default: '' }, // 是否显示 show: { type: Boolean, default: true }, // 最大值,超过最大值会显示 '{max}+' max: { type: [Number, String], default: 999 }, // 主题类型,error|warning|success|primary type: { type: [String,undefined,null], default: 'error' }, // 当数值为 0 时,是否展示 Badge showZero: { type: Boolean, default: false }, // 背景颜色,优先级比type高,如设置,type参数会失效 bgColor: { type: [String, null], default: null }, // 字体颜色 color: { type: [String, null], default: null }, // 徽标形状,circle-四角均为圆角,horn-左下角为直角 shape: { type: [String,undefined,null], default: 'circle' }, // 设置数字的显示方式,overflow|ellipsis|limit // overflow会根据max字段判断,超出显示`${max}+` // ellipsis会根据max判断,超出显示`${max}...` // limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数 numberType: { type: [String,undefined,null], default: 'overflow' }, // 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效 offset: { type: Array, default: () => [] }, // 是否反转背景和字体颜色 inverted: { type: Boolean, default: false }, // 是否绝对定位 absolute: { type: Boolean, default: false }, ...uni.$uv?.props?.badge } }
2301_77169380/AppruanjianApk
uni_modules/uv-badge/components/uv-badge/props.js
JavaScript
unknown
1,687
<template> <text v-if="show && ((Number(value) === 0 ? showZero : true) || isDot)" :class="[isDot ? 'uv-badge--dot' : 'uv-badge--not-dot', inverted && 'uv-badge--inverted', shape === 'horn' && 'uv-badge--horn', `uv-badge--${propsType}${inverted ? '--inverted' : ''}`]" :style="[$uv.addStyle(customStyle), badgeStyle]" class="uv-badge" >{{ isDot ? '' :showValue }}</text> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * badge 徽标数 * @description 该组件一般用于图标右上角显示未读的消息数量,提示用户点击,有圆点和圆包含文字两种形式。 * @tutorial https://www.uvui.cn/components/badge.html * * @property {Boolean} isDot 是否显示圆点 (默认 false ) * @property {String | Number} value 显示的内容 * @property {Boolean} show 是否显示 (默认 true ) * @property {String | Number} max 最大值,超过最大值会显示 '{max}+' (默认999) * @property {String} type 主题类型,error|warning|success|primary (默认 'error' ) * @property {Boolean} showZero 当数值为 0 时,是否展示 Badge (默认 false ) * @property {String} bgColor 背景颜色,优先级比type高,如设置,type参数会失效 * @property {String} color 字体颜色 (默认 '#ffffff' ) * @property {String} shape 徽标形状,circle-四角均为圆角,horn-左下角为直角 (默认 'circle' ) * @property {String} numberType 设置数字的显示方式,overflow|ellipsis|limit (默认 'overflow' ) * @property {Array}} offset 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效 * @property {Boolean} inverted 是否反转背景和字体颜色(默认 false ) * @property {Boolean} absolute 是否绝对定位(默认 false ) * @property {Object} customStyle 定义需要用到的外部样式 * @example <uv-badge :type="type" :count="count"></uv-badge> */ export default { name: 'uv-badge', mixins: [mpMixin, mixin, props], computed: { // 是否将badge中心与父组件右上角重合 boxStyle() { let style = {}; return style; }, // 整个组件的样式 badgeStyle() { const style = {} if(this.color) { style.color = this.color } if (this.bgColor && !this.inverted) { style.backgroundColor = this.bgColor } if (this.absolute) { style.position = 'absolute' // 如果有设置offset参数 if(this.offset.length) { // top和right分为为offset的第一个和第二个值,如果没有第二个值,则right等于top const top = this.offset[0] const right = this.offset[1] || top style.top = this.$uv.addUnit(top) style.right = this.$uv.addUnit(right) } } return style }, showValue() { switch (this.numberType) { case "overflow": return Number(this.value) > Number(this.max) ? this.max + "+" : this.value break; case "ellipsis": return Number(this.value) > Number(this.max) ? "..." : this.value break; case "limit": return Number(this.value) > 999 ? Number(this.value) >= 9999 ? Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value / 1e3 * 100) / 100 + "k" : this.value break; default: return Number(this.value) } }, propsType(){ return this.type || 'error' } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; $uv-badge-primary: $uv-primary !default; $uv-badge-error: $uv-error !default; $uv-badge-success: $uv-success !default; $uv-badge-info: $uv-info !default; $uv-badge-warning: $uv-warning !default; $uv-badge-dot-radius: 100px !default; $uv-badge-dot-size: 8px !default; $uv-badge-dot-right: 4px !default; $uv-badge-dot-top: 0 !default; $uv-badge-text-font-size: 11px !default; $uv-badge-text-right: 10px !default; $uv-badge-text-padding: 2px 5px !default; $uv-badge-text-align: center !default; $uv-badge-text-color: #FFFFFF !default; .uv-badge { border-top-right-radius: $uv-badge-dot-radius; border-top-left-radius: $uv-badge-dot-radius; border-bottom-left-radius: $uv-badge-dot-radius; border-bottom-right-radius: $uv-badge-dot-radius; @include flex; line-height: $uv-badge-text-font-size; text-align: $uv-badge-text-align; font-size: $uv-badge-text-font-size; color: $uv-badge-text-color; &--dot { height: $uv-badge-dot-size; width: $uv-badge-dot-size; } &--inverted { font-size: 13px; } &--not-dot { padding: $uv-badge-text-padding; } &--horn { border-bottom-left-radius: 0; } &--primary { background-color: $uv-badge-primary; } &--primary--inverted { color: $uv-badge-primary; } &--error { background-color: $uv-badge-error; } &--error--inverted { color: $uv-badge-error; } &--success { background-color: $uv-badge-success; } &--success--inverted { color: $uv-badge-success; } &--info { background-color: $uv-badge-info; } &--info--inverted { color: $uv-badge-info; } &--warning { background-color: $uv-badge-warning; } &--warning--inverted { color: $uv-badge-warning; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-badge/components/uv-badge/uv-badge.vue
Vue
unknown
5,531
$uv-button-active-opacity:0.75 !default; $uv-button-loading-text-margin-left:4px !default; $uv-button-text-color: #FFFFFF !default; $uv-button-text-plain-error-color:$uv-error !default; $uv-button-text-plain-warning-color:$uv-warning !default; $uv-button-text-plain-success-color:$uv-success !default; $uv-button-text-plain-info-color:$uv-info !default; $uv-button-text-plain-primary-color:$uv-primary !default; .uv-button { &--active { opacity: $uv-button-active-opacity; } &--active--plain { background-color: rgb(217, 217, 217); } &__loading-text { margin-left:$uv-button-loading-text-margin-left; } &__text, &__loading-text { color:$uv-button-text-color; } &__text--plain--error { color:$uv-button-text-plain-error-color; } &__text--plain--warning { color:$uv-button-text-plain-warning-color; } &__text--plain--success{ color:$uv-button-text-plain-success-color; } &__text--plain--info { color:$uv-button-text-plain-info-color; } &__text--plain--primary { color:$uv-button-text-plain-primary-color; } }
2301_77169380/AppruanjianApk
uni_modules/uv-button/components/uv-button/nvue.scss
SCSS
unknown
1,059
export default { props: { // 是否细边框 hairline: { type: Boolean, default: true }, // 按钮的预置样式,info,primary,error,warning,success type: { type: String, default: 'info' }, // 按钮尺寸,large,normal,small,mini size: { type: String, default: 'normal' }, // 按钮形状,circle(两边为半圆),square(带圆角) shape: { type: String, default: 'square' }, // 按钮是否镂空 plain: { type: Boolean, default: false }, // 是否禁止状态 disabled: { type: Boolean, default: false }, // 是否加载中 loading: { type: Boolean, default: false }, // 加载中提示文字 loadingText: { type: [String, Number], default: '' }, // 加载状态图标类型 loadingMode: { type: String, default: 'spinner' }, // 加载图标大小 loadingSize: { type: [String, Number], default: 14 }, // 开放能力,具体请看uniapp稳定关于button组件部分说明 // https://uniapp.dcloud.io/component/button openType: { type: String, default: '' }, // 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 // 取值为submit(提交表单),reset(重置表单) formType: { type: String, default: '' }, // 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 // 只微信小程序、QQ小程序有效 appParameter: { type: String, default: '' }, // 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 hoverStopPropagation: { type: Boolean, default: true }, // 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效 lang: { type: String, default: 'en' }, // 会话来源,open-type="contact"时有效。只微信小程序有效 sessionFrom: { type: String, default: '' }, // 会话内消息卡片标题,open-type="contact"时有效 // 默认当前标题,只微信小程序有效 sendMessageTitle: { type: String, default: '' }, // 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 // 默认当前分享路径,只微信小程序有效 sendMessagePath: { type: String, default: '' }, // 会话内消息卡片图片,open-type="contact"时有效 // 默认当前页面截图,只微信小程序有效 sendMessageImg: { type: String, default: '' }, // 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示, // 用户点击后可以快速发送小程序消息,open-type="contact"时有效 showMessageCard: { type: Boolean, default: true }, // 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 dataName: { type: String, default: '' }, // 节流,一定时间内只能触发一次 throttleTime: { type: [String, Number], default: 0 }, // 按住后多久出现点击态,单位毫秒 hoverStartTime: { type: [String, Number], default: 0 }, // 手指松开后点击态保留时间,单位毫秒 hoverStayTime: { type: [String, Number], default: 200 }, // 按钮文字,之所以通过props传入,是因为slot传入的话 // nvue中无法控制文字的样式 text: { type: [String, Number], default: '' }, // 按钮图标 icon: { type: String, default: '' }, // 按钮图标大小 iconSize: { type: [String, Number], default: '' }, // 按钮图标颜色 iconColor: { type: String, default: '#000000' }, // 按钮颜色,支持传入linear-gradient渐变色 color: { type: String, default: '' }, // 自定义按钮文本样式 customTextStyle: { type: [Object,String], default: '' }, ...uni.$uv?.props?.button } }
2301_77169380/AppruanjianApk
uni_modules/uv-button/components/uv-button/props.js
JavaScript
unknown
3,947
<template> <view class="uv-button-wrapper" :style="[btnWrapperStyle]" > <!-- #ifndef APP-NVUE --> <!-- #ifdef MP --> <!-- 为了解决微信小程序动态设置hover-class点击态不消失的BUG --> <view class="uv-button-wrapper--dis" v-if="disabled || loading"></view> <button :hover-start-time="Number(hoverStartTime)" :hover-stay-time="Number(hoverStayTime)" :form-type="formType" :open-type="openType" :app-parameter="appParameter" :hover-stop-propagation="hoverStopPropagation" :send-message-title="sendMessageTitle" :send-message-path="sendMessagePath" :lang="lang" :data-name="dataName" :session-from="sessionFrom" :send-message-img="sendMessageImg" :show-message-card="showMessageCard" @getphonenumber="onGetPhoneNumber" @getuserinfo="onGetUserInfo" @error="onError" @opensetting="onOpenSetting" @launchapp="onLaunchApp" @contact="onContact" @chooseavatar="onChooseavatar" @agreeprivacyauthorization="onAgreeprivacyauthorization" @addgroupapp="onAddgroupapp" @chooseaddress="onChooseaddress" @subscribe="onSubscribe" @login="onLogin" @im="onIm" hover-class="uv-button--active" class="uv-button uv-reset-button" :style="[baseColor, $uv.addStyle(customStyle)]" @tap="clickHandler" :class="bemClass" > <!-- #endif --> <!-- #ifndef MP --> <button :hover-start-time="Number(hoverStartTime)" :hover-stay-time="Number(hoverStayTime)" :form-type="formType" :open-type="openType" :app-parameter="appParameter" :hover-stop-propagation="hoverStopPropagation" :send-message-title="sendMessageTitle" :send-message-path="sendMessagePath" :lang="lang" :data-name="dataName" :session-from="sessionFrom" :send-message-img="sendMessageImg" :show-message-card="showMessageCard" :hover-class="!disabled && !loading ? 'uv-button--active' : ''" class="uv-button uv-reset-button" :style="[baseColor, $uv.addStyle(customStyle)]" @tap="clickHandler" :class="bemClass" > <!-- #endif --> <template v-if="loading"> <uv-loading-icon :mode="loadingMode" :size="loadingSize * 1.15" :color="loadingColor" ></uv-loading-icon> <text class="uv-button__loading-text" :style="[ { fontSize: textSize + 'px' }, $uv.addStyle(customTextStyle) ]" >{{ loadingText || text }}</text> </template> <template v-else> <uv-icon v-if="icon" :name="icon" :color="iconColorCom" :size="getIconSize" :customStyle="{ marginRight: '2px' }" ></uv-icon> <slot> <text class="uv-button__text" :style="[ { fontSize: textSize + 'px' }, $uv.addStyle(customTextStyle) ]" >{{ text }}</text> </slot> <slot name="suffix"></slot> </template> </button> <!-- #endif --> <!-- #ifdef APP-NVUE --> <view :hover-start-time="Number(hoverStartTime)" :hover-stay-time="Number(hoverStayTime)" class="uv-button" :hover-class=" !disabled && !loading && !color && (plain || type === 'info') ? 'uv-button--active--plain' : !disabled && !loading && !plain ? 'uv-button--active' : '' " @tap="clickHandler" :class="bemClass" :style="[baseColor, $uv.addStyle(customStyle)]" > <template v-if="loading"> <uv-loading-icon :mode="loadingMode" :size="loadingSize * 1.15" :color="loadingColor" ></uv-loading-icon> <text class="uv-button__loading-text" :style="[nvueTextStyle,$uv.addStyle(customTextStyle)]" :class="[plain && `uv-button__text--plain--${type}`]" >{{ loadingText || text }}</text> </template> <template v-else> <uv-icon v-if="icon" :name="icon" :color="iconColorCom" :size="getIconSize" ></uv-icon> <text class="uv-button__text" :style="[ { marginLeft: icon ? '2px' : 0, }, nvueTextStyle, $uv.addStyle(customTextStyle) ]" :class="[plain && `uv-button__text--plain--${type}`]" >{{ text }}</text> <slot name="suffix"></slot> </template> </view> <!-- #endif --> </view> </template> <script> import throttle from '@/uni_modules/uv-ui-tools/libs/function/throttle.js'; import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import button from '@/uni_modules/uv-ui-tools/libs/mixin/button.js' import openType from '@/uni_modules/uv-ui-tools/libs/mixin/openType.js' import props from "./props.js"; /** * button 按钮 * @description Button 按钮 * @tutorial https://www.uvui.cn/components/button.html * @property {Boolean} hairline 是否显示按钮的细边框 (默认 true ) * @property {String} type 按钮的预置样式,info,primary,error,warning,success (默认 'info' ) * @property {String} size 按钮尺寸,large,normal,mini (默认 normal) * @property {String} shape 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' ) * @property {Boolean} plain 按钮是否镂空,背景色透明 (默认 false) * @property {Boolean} disabled 是否禁用 (默认 false) * @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false) * @property {String | Number} loadingText 加载中提示文字 * @property {String} loadingMode 加载状态图标类型 (默认 'spinner' ) * @property {String | Number} loadingSize 加载图标大小 (默认 15 ) * @property {String} openType 开放能力,具体请看uniapp稳定关于button组件部分说明 * @property {String} formType 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 * @property {String} appParameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) * @property {Boolean} hoverStopPropagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true ) * @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) * @property {String} sessionFrom 会话来源,openType="contact"时有效 * @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效 * @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 * @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效 * @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false) * @property {String} dataName 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 * @property {String | Number} throttleTime 节流,一定时间内只能触发一次 (默认 0 ) * @property {String | Number} hoverStartTime 按住后多久出现点击态,单位毫秒 (默认 0 ) * @property {String | Number} hoverStayTime 手指松开后点击态保留时间,单位毫秒 (默认 200 ) * @property {String | Number} text 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) * @property {String} icon 按钮图标 * @property {String} iconColor 按钮图标颜色 * @property {String} color 按钮颜色,支持传入linear-gradient渐变色 * @property {Object} customStyle 定义需要用到的外部样式 * @event {Function} click 非禁止并且非加载中,才能点击 * @event {Function} getphonenumber open-type="getPhoneNumber"时有效 * @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo * @event {Function} error 当使用开放能力时,发生错误的回调 * @event {Function} opensetting 在打开授权设置页并关闭后回调 * @event {Function} launchapp 打开 APP 成功的回调 * @example <uv-button>月落</uv-button> */ export default { name: "uv-button", // #ifdef MP mixins: [mpMixin, mixin, button, openType, props], // #endif // #ifndef MP mixins: [mpMixin, mixin, props], // #endif emits: ['click'], data() { return {}; }, computed: { // 生成bem风格的类名 bemClass() { // this.bem为一个computed变量,在mixin中 if (!this.color) { return this.bem("button", ["type", "shape", "size"], ["disabled", "plain", "hairline"]); } else { // 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式 return this.bem("button", ["shape", "size"], ["disabled", "plain", "hairline"]); } }, loadingColor() { if (this.plain) { // 如果有设置color值,则用color值,否则使用type主题颜色 return this.color ? this.color : '#3c9cff'; } if (this.type === "info") { return "#c9c9c9"; } return "rgb(200, 200, 200)"; }, iconColorCom() { // 如果是镂空状态,设置了color就用color值,否则使用主题颜色, // uv-icon的color能接受一个主题颜色的值 if (this.iconColor) return this.iconColor; if (this.plain) { return this.color ? this.color : this.type; } else { return this.type === "info" ? "#000000" : "#ffffff"; } }, baseColor() { let style = {}; if (this.color) { // 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色 style.color = this.plain ? this.color : "white"; if (!this.plain) { // 非镂空,背景色使用自定义的颜色 style["background-color"] = this.color; } if (this.color.indexOf("gradient") !== -1) { // 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色 // weex文档说明可以写borderWidth的形式,为什么这里需要分开写? // 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效 style.borderTopWidth = 0; style.borderRightWidth = 0; style.borderBottomWidth = 0; style.borderLeftWidth = 0; if (!this.plain) { style.backgroundImage = this.color; } } else { // 非渐变色,则设置边框相关的属性 style.borderColor = this.color; style.borderWidth = "1px"; style.borderStyle = "solid"; } } return style; }, // nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置 nvueTextStyle() { let style = {}; // 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色 if (this.type === "info") { style.color = "#323233"; } if (this.color) { style.color = this.plain ? this.color : "white"; } style.fontSize = this.textSize + "px"; return style; }, // 字体大小 textSize() { let fontSize = 14, { size } = this; if (size === "large") fontSize = 16; if (size === "normal") fontSize = 14; if (size === "small") fontSize = 12; if (size === "mini") fontSize = 10; return fontSize; }, // 设置图标大小 getIconSize() { const size = this.iconSize ? this.iconSize : this.textSize * 1.35; return this.$uv.addUnit(size); }, // 设置外层盒子的宽度,其他样式不需要 btnWrapperStyle() { const style = {}; const customStyle = this.$uv.addStyle(this.customStyle); if(customStyle.width) style.width = customStyle.width; return style; } }, methods: { clickHandler() { // 非禁止并且非加载中,才能点击 if (!this.disabled && !this.loading) { // 进行节流控制,每this.throttle毫秒内,只在开始处执行 throttle(() => { this.$emit("click"); }, this.throttleTime); } } } } </script> <style lang="scss" scoped> $show-reset-button: 1; @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; /* #ifndef APP-NVUE */ @import "./vue.scss"; /* #endif */ /* #ifdef APP-NVUE */ @import "./nvue.scss"; /* #endif */ $uv-button-uv-button-height: 40px !default; $uv-button-text-font-size: 15px !default; $uv-button-loading-text-font-size: 15px !default; $uv-button-loading-text-margin-left: 4px !default; $uv-button-large-width: 100% !default; $uv-button-large-height: 50px !default; $uv-button-normal-padding: 0 12px !default; $uv-button-large-padding: 0 15px !default; $uv-button-normal-font-size: 14px !default; $uv-button-small-min-width: 60px !default; $uv-button-small-height: 30px !default; $uv-button-small-padding: 0px 8px !default; $uv-button-mini-padding: 0px 8px !default; $uv-button-small-font-size: 12px !default; $uv-button-mini-height: 22px !default; $uv-button-mini-font-size: 10px !default; $uv-button-mini-min-width: 50px !default; $uv-button-disabled-opacity: 0.5 !default; $uv-button-info-color: #323233 !default; $uv-button-info-background-color: #fff !default; $uv-button-info-border-color: #ebedf0 !default; $uv-button-info-border-width: 1px !default; $uv-button-info-border-style: solid !default; $uv-button-success-color: #fff !default; $uv-button-success-background-color: $uv-success !default; $uv-button-success-border-color: $uv-button-success-background-color !default; $uv-button-success-border-width: 1px !default; $uv-button-success-border-style: solid !default; $uv-button-primary-color: #fff !default; $uv-button-primary-background-color: $uv-primary !default; $uv-button-primary-border-color: $uv-button-primary-background-color !default; $uv-button-primary-border-width: 1px !default; $uv-button-primary-border-style: solid !default; $uv-button-error-color: #fff !default; $uv-button-error-background-color: $uv-error !default; $uv-button-error-border-color: $uv-button-error-background-color !default; $uv-button-error-border-width: 1px !default; $uv-button-error-border-style: solid !default; $uv-button-warning-color: #fff !default; $uv-button-warning-background-color: $uv-warning !default; $uv-button-warning-border-color: $uv-button-warning-background-color !default; $uv-button-warning-border-width: 1px !default; $uv-button-warning-border-style: solid !default; $uv-button-block-width: 100% !default; $uv-button-circle-border-top-right-radius: 100px !default; $uv-button-circle-border-top-left-radius: 100px !default; $uv-button-circle-border-bottom-left-radius: 100px !default; $uv-button-circle-border-bottom-right-radius: 100px !default; $uv-button-square-border-top-right-radius: 3px !default; $uv-button-square-border-top-left-radius: 3px !default; $uv-button-square-border-bottom-left-radius: 3px !default; $uv-button-square-border-bottom-right-radius: 3px !default; $uv-button-icon-min-width: 1em !default; $uv-button-plain-background-color: #fff !default; $uv-button-hairline-border-width: 0.5px !default; .uv-button { height: $uv-button-uv-button-height; position: relative; align-items: center; justify-content: center; @include flex; /* #ifndef APP-NVUE */ box-sizing: border-box; /* #endif */ flex-direction: row; &__text { font-size: $uv-button-text-font-size; } &__loading-text { font-size: $uv-button-loading-text-font-size; margin-left: $uv-button-loading-text-margin-left; } &--large { /* #ifndef APP-NVUE */ width: $uv-button-large-width; /* #endif */ height: $uv-button-large-height; padding: $uv-button-large-padding; } &--normal { padding: $uv-button-normal-padding; font-size: $uv-button-normal-font-size; } &--small { /* #ifndef APP-NVUE */ min-width: $uv-button-small-min-width; /* #endif */ height: $uv-button-small-height; padding: $uv-button-small-padding; font-size: $uv-button-small-font-size; } &--mini { height: $uv-button-mini-height; font-size: $uv-button-mini-font-size; /* #ifndef APP-NVUE */ min-width: $uv-button-mini-min-width; /* #endif */ padding: $uv-button-mini-padding; } &--disabled { opacity: $uv-button-disabled-opacity; } &--info { color: $uv-button-info-color; background-color: $uv-button-info-background-color; border-color: $uv-button-info-border-color; border-width: $uv-button-info-border-width; border-style: $uv-button-info-border-style; } &--success { color: $uv-button-success-color; background-color: $uv-button-success-background-color; border-color: $uv-button-success-border-color; border-width: $uv-button-success-border-width; border-style: $uv-button-success-border-style; } &--primary { color: $uv-button-primary-color; background-color: $uv-button-primary-background-color; border-color: $uv-button-primary-border-color; border-width: $uv-button-primary-border-width; border-style: $uv-button-primary-border-style; } &--error { color: $uv-button-error-color; background-color: $uv-button-error-background-color; border-color: $uv-button-error-border-color; border-width: $uv-button-error-border-width; border-style: $uv-button-error-border-style; } &--warning { color: $uv-button-warning-color; background-color: $uv-button-warning-background-color; border-color: $uv-button-warning-border-color; border-width: $uv-button-warning-border-width; border-style: $uv-button-warning-border-style; } &--block { @include flex; width: $uv-button-block-width; } &--circle { border-top-right-radius: $uv-button-circle-border-top-right-radius; border-top-left-radius: $uv-button-circle-border-top-left-radius; border-bottom-left-radius: $uv-button-circle-border-bottom-left-radius; border-bottom-right-radius: $uv-button-circle-border-bottom-right-radius; } &--square { border-bottom-left-radius: $uv-button-square-border-top-right-radius; border-bottom-right-radius: $uv-button-square-border-top-left-radius; border-top-left-radius: $uv-button-square-border-bottom-left-radius; border-top-right-radius: $uv-button-square-border-bottom-right-radius; } &__icon { /* #ifndef APP-NVUE */ min-width: $uv-button-icon-min-width; line-height: inherit !important; vertical-align: top; /* #endif */ } &--plain { background-color: $uv-button-plain-background-color; } &--hairline { border-width: $uv-button-hairline-border-width !important; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-button/components/uv-button/uv-button.vue
Vue
unknown
19,783
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; // nvue下hover-class无效 $uv-button-before-top:50% !default; $uv-button-before-left:50% !default; $uv-button-before-width:100% !default; $uv-button-before-height:100% !default; $uv-button-before-transform:translate(-50%, -50%) !default; $uv-button-before-opacity:0 !default; $uv-button-before-background-color:#000 !default; $uv-button-before-border-color:#000 !default; $uv-button-active-before-opacity:.15 !default; $uv-button-icon-margin-left:4px !default; $uv-button-plain-uv-button-info-color:$uv-info; $uv-button-plain-uv-button-success-color:$uv-success; $uv-button-plain-uv-button-error-color:$uv-error; $uv-button-plain-uv-button-warning-color:$uv-warning; .uv-button-wrapper { position: relative; &--dis { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 9; } } .uv-button { width: 100%; &__text { white-space: nowrap; line-height: 1; } &:before { position: absolute; top:$uv-button-before-top; left:$uv-button-before-left; width:$uv-button-before-width; height:$uv-button-before-height; border: inherit; border-radius: inherit; transform:$uv-button-before-transform; opacity:$uv-button-before-opacity; content: " "; background-color:$uv-button-before-background-color; border-color:$uv-button-before-border-color; } &--active { &:before { opacity: .15 } } &__icon+&__text:not(:empty), &__loading-text { margin-left:$uv-button-icon-margin-left; } &--plain { &.uv-button--primary { color: $uv-primary; } } &--plain { &.uv-button--info { color:$uv-button-plain-uv-button-info-color; } } &--plain { &.uv-button--success { color:$uv-button-plain-uv-button-success-color; } } &--plain { &.uv-button--error { color:$uv-button-plain-uv-button-error-color; } } &--plain { &.uv-button--warning { color:$uv-button-plain-uv-button-warning-color; } } }
2301_77169380/AppruanjianApk
uni_modules/uv-button/components/uv-button/vue.scss
SCSS
unknown
1,956
/** * @1900-2100区间内的公历、农历互转 * @charset UTF-8 * @github https://github.com/jjonline/calendar.js * @Author Jea杨(JJonline@JJonline.Cn) * @Time 2014-7-21 * @Time 2016-8-13 Fixed 2033hex、Attribution Annals * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year * @Version 1.0.3 * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] */ /* eslint-disable */ var calendar = { /** * 农历1900-2100的润大小信息表 * @Array Of Property * @return Hex */ lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 /** Add By JJonline@JJonline.Cn**/ 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 0x0d520], // 2100 /** * 公历每个月份的天数普通表 * @Array Of Property * @return Number */ solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], /** * 天干地支之天干速查表 * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] * @return Cn string */ Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], /** * 天干地支之地支速查表 * @Array Of Property * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] * @return Cn string */ Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], /** * 天干地支之地支速查表<=>生肖 * @Array Of Property * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] * @return Cn string */ Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], /** * 24节气速查表 * @Array Of Property * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] * @return Cn string */ solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], /** * 1900-2100各年的24节气日期速查表 * @Array Of Property * @return 0x string For splice */ sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], /** * 数字转中文速查表 * @Array Of Property * @trans ['日','一','二','三','四','五','六','七','八','九','十'] * @return Cn string */ nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], /** * 日期转农历称呼速查表 * @Array Of Property * @trans ['初','十','廿','卅'] * @return Cn string */ nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], /** * 月份转农历称呼速查表 * @Array Of Property * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] * @return Cn string */ nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], /** * 返回农历y年一整年的总天数 * @param lunar Year * @return Number * @eg:var count = calendar.lYearDays(1987) ;//count=387 */ lYearDays: function (y) { var i; var sum = 348 for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } return (sum + this.leapDays(y)) }, /** * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 * @param lunar Year * @return Number (0-12) * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 */ leapMonth: function (y) { // 闰字编码 \u95f0 return (this.lunarInfo[y - 1900] & 0xf) }, /** * 返回农历y年闰月的天数 若该年没有闰月则返回0 * @param lunar Year * @return Number (0、29、30) * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 */ leapDays: function (y) { if (this.leapMonth(y)) { return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) } return (0) }, /** * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 * @param lunar Year * @return Number (-1、29、30) * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 */ monthDays: function (y, m) { if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1 return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) }, /** * 返回公历(!)y年m月的天数 * @param solar Year * @return Number (-1、28、29、30、31) * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 */ solarDays: function (y, m) { if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 var ms = m - 1 if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29 return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) } else { return (this.solarMonth[ms]) } }, /** * 农历年份转换为干支纪年 * @param lYear 农历年的年份数 * @return Cn string */ toGanZhiYear: function (lYear) { var ganKey = (lYear - 3) % 10 var zhiKey = (lYear - 3) % 12 if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干 if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支 return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] }, /** * 公历月、日判断所属星座 * @param cMonth [description] * @param cDay [description] * @return Cn string */ toAstro: function (cMonth, cDay) { var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座 }, /** * 传入offset偏移量返回干支 * @param offset 相对甲子的偏移量 * @return Cn string */ toGanZhi: function (offset) { return this.Gan[offset % 10] + this.Zhi[offset % 12] }, /** * 传入公历(!)y年获得该年第n个节气的公历日期 * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 * @return day Number * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 */ getTerm: function (y, n) { if (y < 1900 || y > 2100) { return -1 } if (n < 1 || n > 24) { return -1 } var _table = this.sTermInfo[y - 1900] var _info = [ parseInt('0x' + _table.substr(0, 5)).toString(), parseInt('0x' + _table.substr(5, 5)).toString(), parseInt('0x' + _table.substr(10, 5)).toString(), parseInt('0x' + _table.substr(15, 5)).toString(), parseInt('0x' + _table.substr(20, 5)).toString(), parseInt('0x' + _table.substr(25, 5)).toString() ] var _calday = [ _info[0].substr(0, 1), _info[0].substr(1, 2), _info[0].substr(3, 1), _info[0].substr(4, 2), _info[1].substr(0, 1), _info[1].substr(1, 2), _info[1].substr(3, 1), _info[1].substr(4, 2), _info[2].substr(0, 1), _info[2].substr(1, 2), _info[2].substr(3, 1), _info[2].substr(4, 2), _info[3].substr(0, 1), _info[3].substr(1, 2), _info[3].substr(3, 1), _info[3].substr(4, 2), _info[4].substr(0, 1), _info[4].substr(1, 2), _info[4].substr(3, 1), _info[4].substr(4, 2), _info[5].substr(0, 1), _info[5].substr(1, 2), _info[5].substr(3, 1), _info[5].substr(4, 2) ] return parseInt(_calday[n - 1]) }, /** * 传入农历数字月份返回汉语通俗表示法 * @param lunar month * @return Cn string * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' */ toChinaMonth: function (m) { // 月 => \u6708 if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 var s = this.nStr3[m - 1] s += '\u6708'// 加上月字 return s }, /** * 传入农历日期数字返回汉字表示法 * @param lunar day * @return Cn string * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' */ toChinaDay: function (d) { // 日 => \u65e5 var s switch (d) { case 10: s = '\u521d\u5341'; break case 20: s = '\u4e8c\u5341'; break break case 30: s = '\u4e09\u5341'; break break default: s = this.nStr2[Math.floor(d / 10)] s += this.nStr1[d % 10] } return (s) }, /** * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” * @param y year * @return Cn string * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' */ getAnimal: function (y) { return this.Animals[(y - 4) % 12] }, /** * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON * @param y solar year * @param m solar month * @param d solar day * @return JSON object * @eg:console.log(calendar.solar2lunar(1987,11,01)); */ solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31 // 年份限定、上限 if (y < 1900 || y > 2100) { return -1// undefined转换为数字变为NaN } // 公历传参最下限 if (y == 1900 && m == 1 && d < 31) { return -1 } // 未传参 获得当天 if (!y) { var objDate = new Date() } else { var objDate = new Date(y, parseInt(m) - 1, d) } var i; var leap = 0; var temp = 0 // 修正ymd参数 var y = objDate.getFullYear() var m = objDate.getMonth() + 1 var d = objDate.getDate() var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 for (i = 1900; i < 2101 && offset > 0; i++) { temp = this.lYearDays(i) offset -= temp } if (offset < 0) { offset += temp; i-- } // 是否今天 var isTodayObj = new Date() var isToday = false if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { isToday = true } // 星期几 var nWeek = objDate.getDay() var cWeek = this.nStr1[nWeek] // 数字表示周几顺应天朝周一开始的惯例 if (nWeek == 0) { nWeek = 7 } // 农历年 var year = i var leap = this.leapMonth(i) // 闰哪个月 var isLeap = false // 效验闰月 for (i = 1; i < 13 && offset > 0; i++) { // 闰月 if (leap > 0 && i == (leap + 1) && isLeap == false) { --i isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数 } else { temp = this.monthDays(year, i)// 计算农历普通月天数 } // 解除闰月 if (isLeap == true && i == (leap + 1)) { isLeap = false } offset -= temp } // 闰月导致数组下标重叠取反 if (offset == 0 && leap > 0 && i == leap + 1) { if (isLeap) { isLeap = false } else { isLeap = true; --i } } if (offset < 0) { offset += temp; --i } // 农历月 var month = i // 农历日 var day = offset + 1 // 天干地支处理 var sm = m - 1 var gzY = this.toGanZhiYear(year) // 当月的两个节气 // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始 var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始 // 依据12节气修正干支月 var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) if (d >= firstNode) { gzM = this.toGanZhi((y - 1900) * 12 + m + 12) } // 传入的日期的节气与否 var isTerm = false var Term = null if (firstNode == d) { isTerm = true Term = this.solarTerm[m * 2 - 2] } if (secondNode == d) { isTerm = true Term = this.solarTerm[m * 2 - 1] } // 日柱 当月一日与 1900/1/1 相差天数 var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 var gzD = this.toGanZhi(dayCyclical + d - 1) // 该日期所属的星座 var astro = this.toAstro(m, d) return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } }, /** * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON * @param y lunar year * @param m lunar month * @param d lunar day * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] * @return JSON object * @eg:console.log(calendar.lunar2solar(1987,9,10)); */ lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1 var isLeapMonth = !!isLeapMonth var leapOffset = 0 var leapMonth = this.leapMonth(y) var leapDay = this.leapDays(y) if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值 var day = this.monthDays(y, m) var _day = day // bugFix 2016-9-25 // if month is leap, _day use leapDays method if (isLeapMonth) { _day = this.leapDays(y, m) } if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验 // 计算农历的时间差 var offset = 0 for (var i = 1900; i < y; i++) { offset += this.lYearDays(i) } var leap = 0; var isAdd = false for (var i = 1; i < m; i++) { leap = this.leapMonth(y) if (!isAdd) { // 处理闰月 if (leap <= i && leap > 0) { offset += this.leapDays(y); isAdd = true } } offset += this.monthDays(y, i) } // 转换闰月农历 需补充该年闰月的前一个月的时差 if (isLeapMonth) { offset += day } // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) var calObj = new Date((offset + d - 31) * 86400000 + stmap) var cY = calObj.getUTCFullYear() var cM = calObj.getUTCMonth() + 1 var cD = calObj.getUTCDate() return this.solar2lunar(cY, cM, cD) } } export default calendar
2301_77169380/AppruanjianApk
uni_modules/uv-calendar/components/uv-calendar/calendar.js
JavaScript
unknown
26,648
<template> <view class="uv-calendar-header uv-border-bottom"> <text class="uv-calendar-header__title" v-if="showTitle" >{{ title }}</text> <text class="uv-calendar-header__subtitle" v-if="showSubtitle" >{{ subtitle }}</text> <view class="uv-calendar-header__weekdays"> <text class="uv-calendar-header__weekdays__weekday">一</text> <text class="uv-calendar-header__weekdays__weekday">二</text> <text class="uv-calendar-header__weekdays__weekday">三</text> <text class="uv-calendar-header__weekdays__weekday">四</text> <text class="uv-calendar-header__weekdays__weekday">五</text> <text class="uv-calendar-header__weekdays__weekday">六</text> <text class="uv-calendar-header__weekdays__weekday">日</text> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' export default { name: 'uv-calendar-header', mixins: [mpMixin, mixin], props: { // 标题 title: { type: String, default: '' }, // 副标题 subtitle: { type: [String,null], default: '' }, // 是否显示标题 showTitle: { type: Boolean, default: true }, // 是否显示副标题 showSubtitle: { type: Boolean, default: true }, }, data() { return { } }, methods: { name() { } }, } </script> <style lang="scss" scoped> $show-border: 1; $show-border-bottom: 1; @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; .uv-calendar-header { padding-bottom: 4px; &__title { font-size: 16px; color: $uv-main-color; text-align: center; height: 42px; line-height: 42px; font-weight: bold; } &__subtitle { font-size: 14px; color: $uv-main-color; height: 40px; text-align: center; line-height: 40px; font-weight: bold; } &__weekdays { @include flex; justify-content: space-between; &__weekday { font-size: 13px; color: $uv-main-color; line-height: 30px; flex: 1; text-align: center; } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendar/components/uv-calendar/header.vue
Vue
unknown
2,239
<template> <view class="uv-calendar-month-wrapper" ref="uv-calendar-month-wrapper"> <view v-for="(item, index) in months" :key="index" :class="[`uv-calendar-month-${index}`]" :ref="`uv-calendar-month-${index}`" :id="`month-${index}`"> <text v-if="index !== 0" class="uv-calendar-month__title">{{ item.year }}年{{ item.month }}月</text> <view class="uv-calendar-month__days"> <view v-if="showMark" class="uv-calendar-month__days__month-mark-wrapper"> <text class="uv-calendar-month__days__month-mark-wrapper__text">{{ item.month }}</text> </view> <view class="uv-calendar-month__days__day" v-for="(item1, index1) in item.date" :key="index1" :style="[dayStyle(index, index1, item1)]" @tap="clickHandler(index, index1, item1)" :class="[item1.selected && 'uv-calendar-month__days__day__select--selected']"> <view class="uv-calendar-month__days__day__select" :style="[daySelectStyle(index, index1, item1)]"> <text v-if="getTopInfo(index, index1, item1)" class="uv-calendar-month__days__day__select__top-info" :class="[item1.disabled && 'uv-calendar-month__days__day__select__top-info--disabled']" :style="[textStyle(item1)]" >{{ getTopInfo(index, index1, item1) }}</text> <text class="uv-calendar-month__days__day__select__info" :class="[item1.disabled && 'uv-calendar-month__days__day__select__info--disabled']" :style="[textStyle(item1)]">{{ item1.day }}</text> <text v-if="getBottomInfo(index, index1, item1)" class="uv-calendar-month__days__day__select__buttom-info" :class="[item1.disabled && 'uv-calendar-month__days__day__select__buttom-info--disabled']" :style="[textStyle(item1)]">{{ getBottomInfo(index, index1, item1) }}</text> <text v-if="item1.dot" class="uv-calendar-month__days__day__select__dot"></text> </view> </view> </view> </view> </view> </template> <script> // #ifdef APP-NVUE // 由于nvue不支持百分比单位,需要查询宽度来计算每个日期的宽度 const dom = uni.requireNativePlugin('dom') // #endif import { colorGradient } from '@/uni_modules/uv-ui-tools/libs/function/colorGradient.js'; import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import dayjs from '@/uni_modules/uv-ui-tools/libs/util/dayjs.js' export default { name: 'uv-calendar-month', emits:['monthSelected','updateMonthTop','change'], mixins: [mpMixin, mixin], props: { // 是否显示月份背景色 showMark: { type: Boolean, default: true }, // 主题色,对底部按钮和选中日期有效 color: { type: String, default: '#3c9cff' }, // 月份数据 months: { type: Array, default: () => [] }, // 日期选择类型 mode: { type: String, default: 'single' }, // 日期行高 rowHeight: { type: [String, Number], default: 58 }, // mode=multiple时,最多可选多少个日期 maxCount: { type: [String, Number], default: Infinity }, // mode=range时,第一个日期底部的提示文字 startText: { type: String, default: '开始' }, // mode=range时,最后一个日期底部的提示文字 endText: { type: String, default: '结束' }, // 默认选中的日期,mode为multiple或range是必须为数组格式 defaultDate: { type: [Array, String, Date], default: null }, // 最小的可选日期 minDate: { type: [String, Number], default: 0 }, // 最大可选日期 maxDate: { type: [String, Number], default: 0 }, // 如果没有设置maxDate,则往后推多少个月 maxMonth: { type: [String, Number], default: 2 }, // 是否为只读状态,只读状态下禁止选择日期 readonly: { type: Boolean, default: false }, // 日期区间最多可选天数,默认无限制,mode = range时有效 maxRange: { type: [Number, String], default: Infinity }, // 范围选择超过最多可选天数时的提示文案,mode = range时有效 rangePrompt: { type: String, default: '' }, // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 showRangePrompt: { type: Boolean, default: true }, // 是否允许日期范围的起止时间为同一天,mode = range时有效 allowSameDay: { type: Boolean, default: false } }, data() { return { // 每个日期的宽度 width: 0, // 当前选中的日期item item: {}, selected: [] } }, watch: { selectedChange: { immediate: true, handler(n) { this.setDefaultDate() } } }, computed: { // 多个条件的变化,会引起选中日期的变化,这里统一管理监听 selectedChange() { return [this.minDate, this.maxDate, this.defaultDate] }, dayStyle(index1, index2, item) { return (index1, index2, item) => { const style = {} let week = item.week // 不进行四舍五入的形式保留2位小数 const dayWidth = Number(parseFloat(this.width / 7).toFixed(3).slice(0, -1)) // 得出每个日期的宽度 // #ifdef APP-NVUE style.width = this.$uv.addUnit(dayWidth) // #endif style.height = this.$uv.addUnit(this.rowHeight) if (index2 === 0) { // 获取当前为星期几,如果为0,则为星期天,减一为每月第一天时,需要向左偏移的item个数 week = (week === 0 ? 7 : week) - 1 style.marginLeft = this.$uv.addUnit(week * dayWidth) } if (this.mode === 'range') { // 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug style.paddingLeft = 0 style.paddingRight = 0 style.paddingBottom = 0 style.paddingTop = 0 } return style } }, daySelectStyle() { return (index1, index2, item) => { let date = dayjs(item.date).format("YYYY-MM-DD"), style = {} // 判断date是否在selected数组中,因为月份可能会需要补0,所以使用dateSame判断,而不用数组的includes判断 if (this.selected.some(item => this.dateSame(item, date))) { style.backgroundColor = this.color } if (this.mode === 'single') { if (date === this.selected[0]) { // 因为需要对nvue的兼容,只能这么写,无法缩写,也无法通过类名控制等等 style.borderTopLeftRadius = '3px' style.borderBottomLeftRadius = '3px' style.borderTopRightRadius = '3px' style.borderBottomRightRadius = '3px' } } else if (this.mode === 'range') { if (this.selected.length >= 2) { const len = this.selected.length - 1 // 第一个日期设置左上角和左下角的圆角 if (this.dateSame(date, this.selected[0])) { style.borderTopLeftRadius = '3px' style.borderBottomLeftRadius = '3px' } // 最后一个日期设置右上角和右下角的圆角 if (this.dateSame(date, this.selected[len])) { style.borderTopRightRadius = '3px' style.borderBottomRightRadius = '3px' } // 处于第一和最后一个之间的日期,背景色设置为浅色,通过将对应颜色进行等分,再取其尾部的颜色值 if (dayjs(date).isAfter(dayjs(this.selected[0])) && dayjs(date).isBefore(dayjs(this .selected[len]))) { style.backgroundColor = colorGradient(this.color, '#ffffff', 100)[90] // 增加一个透明度,让范围区间的背景色也能看到底部的mark水印字符 style.opacity = 0.7 } } else if (this.selected.length === 1) { // 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug // 进行还原操作,否则在nvue的iOS,uni-app有bug,会导致诡异的表现 style.borderTopLeftRadius = '3px' style.borderBottomLeftRadius = '3px' } } else { if (this.selected.some(item => this.dateSame(item, date))) { style.borderTopLeftRadius = '3px' style.borderBottomLeftRadius = '3px' style.borderTopRightRadius = '3px' style.borderBottomRightRadius = '3px' } } return style } }, // 某个日期是否被选中 textStyle() { return (item) => { const date = dayjs(item.date).format("YYYY-MM-DD"), style = {} // 选中的日期,提示文字设置白色 if (this.selected.some(item => this.dateSame(item, date))) { style.color = '#ffffff' } if (this.mode === 'range') { const len = this.selected.length - 1 // 如果是范围选择模式,第一个和最后一个之间的日期,文字颜色设置为高亮的主题色 if (dayjs(date).isAfter(dayjs(this.selected[0])) && dayjs(date).isBefore(dayjs(this .selected[len]))) { style.color = this.color } } return style } }, // 获取顶部的提示文字 getTopInfo() { return (index1, index2, item) => { return item.topInfo; } }, // 获取底部的提示文字 getBottomInfo() { return (index1, index2, item) => { const date = dayjs(item.date).format("YYYY-MM-DD") const bottomInfo = item.bottomInfo // 当为日期范围模式时,且选择的日期个数大于0时 if (this.mode === 'range' && this.selected.length > 0) { if (this.selected.length === 1) { // 选择了一个日期时,如果当前日期为数组中的第一个日期,则显示底部文字为“开始” if (this.dateSame(date, this.selected[0])) return this.startText else return bottomInfo } else { const len = this.selected.length - 1 // 如果数组中的日期大于2个时,第一个和最后一个显示为开始和结束日期 if (this.dateSame(date, this.selected[0]) && this.dateSame(date, this.selected[1]) && len === 1) { // 如果长度为2,且第一个等于第二个日期,则提示语放在同一个item中 return `${this.startText}/${this.endText}` } else if (this.dateSame(date, this.selected[0])) { return this.startText } else if (this.dateSame(date, this.selected[len])) { return this.endText } else { return bottomInfo } } } else { return bottomInfo } } } }, mounted() { this.init() }, methods: { init() { // 初始化默认选中 this.$emit('monthSelected', this.selected) this.$nextTick(() => { // 这里需要另一个延时,因为获取宽度后,会进行月份数据渲染,只有渲染完成之后,才有真正的高度 // 因为nvue下,$nextTick并不是100%可靠的 this.$uv.sleep(10).then(() => { this.getWrapperWidth() this.getMonthRect() }) }) }, // 判断两个日期是否相等 dateSame(date1, date2) { return dayjs(date1).isSame(dayjs(date2)) }, // 获取月份数据区域的宽度,因为nvue不支持百分比,所以无法通过css设置每个日期item的宽度 getWrapperWidth() { // #ifdef APP-NVUE dom.getComponentRect(this.$refs['uv-calendar-month-wrapper'], res => { this.width = res.size.width }) // #endif // #ifndef APP-NVUE this.$uvGetRect('.uv-calendar-month-wrapper').then(size => { this.width = size.width }) // #endif }, getMonthRect() { // 获取每个月份数据的尺寸,用于父组件在scroll-view滚动事件中,监听当前滚动到了第几个月份 const promiseAllArr = this.months.map((item, index) => this.getMonthRectByPromise( `uv-calendar-month-${index}`)) // 一次性返回 Promise.all(promiseAllArr).then( sizes => { let height = 1 const topArr = [] for (let i = 0; i < this.months.length; i++) { // 添加到months数组中,供scroll-view滚动事件中,判断当前滚动到哪个月份 topArr[i] = height height += sizes[i].height } // 由于微信下,无法通过this.months[i].top的形式(引用类型)去修改父组件的month的top值,所以使用事件形式对外发出 this.$emit('updateMonthTop', topArr) }) }, // 获取每个月份区域的尺寸 getMonthRectByPromise(el) { // #ifndef APP-NVUE // $uvGetRect为uvui自带的节点查询简化方法,详见文档介绍:https://www.uvui.cn/js/getRect.html // 组件内部一般用this.$uvGetRect,对外的为getRect,二者功能一致,名称不同 return new Promise(resolve => { this.$uvGetRect(`.${el}`).then(size => { resolve(size) }) }) // #endif // #ifdef APP-NVUE // nvue下,使用dom模块查询元素高度 // 返回一个promise,让调用此方法的主体能使用then回调 return new Promise(resolve => { dom.getComponentRect(this.$refs[el][0], res => { resolve(res.size) }) }) // #endif }, // 点击某一个日期 clickHandler(index1, index2, item) { if (this.readonly) { return; } this.item = item const date = dayjs(item.date).format("YYYY-MM-DD") if (item.disabled) return // 对上一次选择的日期数组进行深度克隆 let selected = this.$uv.deepClone(this.selected) if (this.mode === 'single') { // 单选情况下,让数组中的元素为当前点击的日期 selected = [date] } else if (this.mode === 'multiple') { if (selected.some(item => this.dateSame(item, date))) { // 如果点击的日期已在数组中,则进行移除操作,也就是达到反选的效果 const itemIndex = selected.findIndex(item => dayjs(item).format("YYYY-MM-DD") === dayjs(date).format("YYYY-MM-DD")) selected.splice(itemIndex, 1) } else { // 如果点击的日期不在数组中,且已有的长度小于总可选长度时,则添加到数组中去 if (selected.length < this.maxCount) selected.push(date) } } else { // 选择区间形式 if (selected.length === 0 || selected.length >= 2) { // 如果原来就为0或者大于2的长度,则当前点击的日期,就是开始日期 selected = [date] } else if (selected.length === 1) { // 如果已经选择了开始日期 const existsDate = selected[0] // 如果当前选择的日期小于上一次选择的日期,则当前的日期定为开始日期 if (dayjs(date).isBefore(existsDate)) { selected = [date] } else if (dayjs(date).isAfter(existsDate)) { // 当前日期减去最大可选的日期天数,如果大于起始时间,则进行提示 if(dayjs(dayjs(date).subtract(this.maxRange, 'day')).isAfter(dayjs(selected[0])) && this.showRangePrompt) { if(this.rangePrompt) { this.$uv.toast(this.rangePrompt) } else { this.$uv.toast(`选择天数不能超过 ${this.maxRange} 天`) } return } // 如果当前日期大于已有日期,将当前的添加到数组尾部 selected.push(date) const startDate = selected[0] const endDate = selected[1] const arr = [] let i = 0 do { // 将开始和结束日期之间的日期添加到数组中 arr.push(dayjs(startDate).add(i, 'day').format("YYYY-MM-DD")) i++ // 累加的日期小于结束日期时,继续下一次的循环 } while (dayjs(startDate).add(i, 'day').isBefore(dayjs(endDate))) // 为了一次性修改数组,避免computed中多次触发,这里才用arr变量一次性赋值的方式,同时将最后一个日期添加近来 arr.push(endDate) selected = arr } else { // 选择区间时,只有一个日期的情况下,且不允许选择起止为同一天的话,不允许选择自己 if (selected[0] === date && !this.allowSameDay) return selected.push(date) } } } this.setSelected(selected) this.$emit('change',{ day: date, selected: selected }); }, // 设置默认日期 setDefaultDate() { if (!this.defaultDate) { // 如果没有设置默认日期,则将当天日期设置为默认选中的日期 const selected = [dayjs().format("YYYY-MM-DD")] return this.setSelected(selected, false) } let defaultDate = [] const minDate = this.minDate || dayjs().format("YYYY-MM-DD") const maxDate = this.maxDate || dayjs(minDate).add(this.maxMonth - 1, 'month').format("YYYY-MM-DD") if (this.mode === 'single') { // 单选模式,可以是字符串或数组,Date对象等 if (!this.$uv.test.array(this.defaultDate)) { defaultDate = [dayjs(this.defaultDate).format("YYYY-MM-DD")] } else { defaultDate = [this.defaultDate[0]] } } else { // 如果为非数组,则不执行 if (!this.$uv.test.array(this.defaultDate)) return defaultDate = this.defaultDate } // 过滤用户传递的默认数组,取出只在可允许最大值与最小值之间的元素 defaultDate = defaultDate.filter(item => { return dayjs(item).isAfter(dayjs(minDate).subtract(1, 'day')) && dayjs(item).isBefore(dayjs( maxDate).add(1, 'day')) }) this.setSelected(defaultDate, false) }, setSelected(selected, event = true) { this.selected = selected event && this.$emit('monthSelected', this.selected) } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; .uv-calendar-month-wrapper { margin-top: 4px; } .uv-calendar-month { &__title { font-size: 14px; line-height: 42px; height: 42px; color: $uv-main-color; text-align: center; font-weight: bold; } &__days { position: relative; @include flex; flex-wrap: wrap; &__month-mark-wrapper { position: absolute; top: 0; bottom: 0; left: 0; right: 0; @include flex; justify-content: center; align-items: center; &__text { font-size: 155px; color: rgba(231, 232, 234, 0.83); } } &__day { @include flex; padding: 2px; /* #ifndef APP-NVUE */ // vue下使用css进行宽度计算,因为某些安卓机会无法进行js获取父元素宽度进行计算得出,会有偏移 width: calc(100% / 7); box-sizing: border-box; /* #endif */ &__select { flex: 1; @include flex; align-items: center; justify-content: center; position: relative; &__dot { width: 7px; height: 7px; border-radius: 100px; background-color: $uv-error; position: absolute; top: 12px; right: 7px; } &__top-info { color: $uv-content-color; text-align: center; position: absolute; top: 2px; font-size: 10px; text-align: center; left: 0; right: 0; &--selected { color: #ffffff; } &--disabled { color: #cacbcd; } } &__buttom-info { color: $uv-content-color; text-align: center; position: absolute; bottom: 5px; font-size: 10px; text-align: center; left: 0; right: 0; &--selected { color: #ffffff; } &--disabled { color: #cacbcd; } } &__info { text-align: center; font-size: 16px; &--selected { color: #ffffff; } &--disabled { color: #cacbcd; } } &--selected { background-color: $uv-primary; @include flex; justify-content: center; align-items: center; flex: 1; border-radius: 3px; } &--range-selected { opacity: 0.3; border-radius: 0; } &--range-start-selected { border-top-right-radius: 0; border-bottom-right-radius: 0; } &--range-end-selected { border-top-left-radius: 0; border-bottom-left-radius: 0; } } } } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendar/components/uv-calendar/month.vue
Vue
unknown
20,253
export default { props: { // 日历顶部标题 title: { type: String, default: '日期选择' }, // 是否显示标题 showTitle: { type: Boolean, default: true }, // 是否显示副标题 showSubtitle: { type: Boolean, default: true }, // 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 mode: { type: String, default: 'single' }, // mode=range时,第一个日期底部的提示文字 startText: { type: String, default: '开始' }, // mode=range时,最后一个日期底部的提示文字 endText: { type: String, default: '结束' }, // 自定义列表 customList: { type: Array, default: () => [] }, // 主题色,对底部按钮和选中日期有效 color: { type: String, default: '#3c9cff' }, // 最小的可选日期 minDate: { type: [String, Number], default: 0 }, // 最大可选日期 maxDate: { type: [String, Number], default: 0 }, // 默认选中的日期,mode为multiple或range是必须为数组格式 defaultDate: { type: [Array, String, Date, null], default: null }, // mode=multiple时,最多可选多少个日期 maxCount: { type: [String, Number], default: Number.MAX_SAFE_INTEGER }, // 日期行高 rowHeight: { type: [String, Number], default: 56 }, // 日期格式化函数 formatter: { type: [Function, null], default: null }, // 是否显示农历 showLunar: { type: Boolean, default: false }, // 是否显示月份背景色 showMark: { type: Boolean, default: true }, // 确定按钮的文字 confirmText: { type: String, default: '确定' }, // 确认按钮处于禁用状态时的文字 confirmDisabledText: { type: String, default: '确定' }, // 是否允许点击遮罩关闭日历 closeOnClickOverlay: { type: Boolean, default: false }, // 是否允许点击确认按钮关闭日历 closeOnClickConfirm: { type: Boolean, default: true }, // 是否为只读状态,只读状态下禁止选择日期 readonly: { type: Boolean, default: false }, // 是否展示确认按钮 showConfirm: { type: Boolean, default: true }, // 日期区间最多可选天数,默认无限制,mode = range时有效 Infinity maxRange: { type: [Number, String], default: Number.MAX_SAFE_INTEGER }, // 范围选择超过最多可选天数时的提示文案,mode = range时有效 rangePrompt: { type: String, default: '' }, // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 showRangePrompt: { type: Boolean, default: true }, // 是否允许日期范围的起止时间为同一天,mode = range时有效 allowSameDay: { type: Boolean, default: false }, // 圆角值 round: { type: [Boolean, String, Number], default: 0 }, // 最多展示月份数量 monthNum: { type: [Number, String], default: 3 }, ...uni.$uv?.props?.calendar } }
2301_77169380/AppruanjianApk
uni_modules/uv-calendar/components/uv-calendar/props.js
JavaScript
unknown
3,098
<template> <uv-popup ref="calendarPopup" mode="bottom" closeable :round="round" :closeOnClickOverlay="closeOnClickOverlay" @change="popupChange" > <view class="uv-calendar"> <uvHeader :title="title" :subtitle="subtitle" :showSubtitle="showSubtitle" :showTitle="showTitle" ></uvHeader> <scroll-view :style="{ height: $uv.addUnit(listHeight) }" scroll-y @scroll="onScroll" :scroll-top="scrollTop" :scrollIntoView="scrollIntoView" > <uvMonth :color="color" :rowHeight="rowHeight" :showMark="showMark" :months="months" :mode="mode" :maxCount="maxCount" :startText="startText" :endText="endText" :defaultDate="defaultDate" :minDate="innerMinDate" :maxDate="innerMaxDate" :maxMonth="monthNum" :readonly="readonly" :maxRange="maxRange" :rangePrompt="rangePrompt" :showRangePrompt="showRangePrompt" :allowSameDay="allowSameDay" ref="month" @monthSelected="monthSelected" @updateMonthTop="updateMonthTop" @change="changeDay" ></uvMonth> </scroll-view> <slot name="footer" v-if="showConfirm"> <view class="uv-calendar__confirm"> <uv-button shape="circle" :text="buttonDisabled ? confirmDisabledText : confirmText" :color="color" @click="confirm" :disabled="buttonDisabled" ></uv-button> </view> </slot> </view> </uv-popup> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import uvHeader from './header.vue' import uvMonth from './month.vue' import props from './props.js' import dayjs from '@/uni_modules/uv-ui-tools/libs/util/dayjs.js' import Calendar from './calendar.js' /** * Calendar 日历 * @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中. * @tutorial https://www.uvui.cn/components/calendar.html * * @property {String} title 标题内容 (默认 日期选择 ) * @property {Boolean} showTitle 是否显示标题 (默认 true ) * @property {Boolean} showSubtitle 是否显示副标题 (默认 true ) * @property {String} mode 日期类型选择 single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 ( 默认 'single' ) * @property {String} startText mode=range时,第一个日期底部的提示文字 (默认 '开始' ) * @property {String} endText mode=range时,最后一个日期底部的提示文字 (默认 '结束' ) * @property {Array} customList 自定义列表 * @property {String} color 主题色,对底部按钮和选中日期有效 (默认 ‘#3c9cff' ) * @property {String | Number} minDate 最小的可选日期 (默认 0 ) * @property {String | Number} maxDate 最大可选日期 (默认 0 ) * @property {Array | String| Date} defaultDate 默认选中的日期,mode为multiple或range是必须为数组格式 * @property {String | Number} maxCount mode=multiple时,最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER ) * @property {String | Number} rowHeight 日期行高 (默认 56 ) * @property {Function} formatter 日期格式化函数 * @property {Boolean} showLunar 是否显示农历 (默认 false ) * @property {Boolean} showMark 是否显示月份背景色 (默认 true ) * @property {String} confirmText 确定按钮的文字 (默认 '确定' ) * @property {String} confirmDisabledText 确认按钮处于禁用状态时的文字 (默认 '确定' ) * @property {Boolean} show 是否显示日历弹窗 (默认 false ) * @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭日历 (默认 false ) * @property {Boolean} closeOnClickConfirm 是否允许点击确认按钮关闭日历,设置为false不影响confirm事件返回 (默认 true ) * @property {Boolean} readonly 是否为只读状态,只读状态下禁止选择日期 (默认 false ) * @property {String | Number} maxRange 日期区间最多可选天数,默认无限制,mode = range时有效 * @property {String} rangePrompt 范围选择超过最多可选天数时的提示文案,mode = range时有效 * @property {Boolean} showRangePrompt 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 (默认 true ) * @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false ) * @property {Number|String} round 圆角值,默认无圆角 (默认 0 ) * @property {Number|String} monthNum 最多展示的月份数量 (默认 3 ) * * @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数 * @event {Function()} close 日历关闭时触发 可定义页面关闭时的回调事件 * @example <uv-calendar ref="calendar" :defaultDate="defaultDateMultiple" mode="multiple" @confirm="confirm"> </uv-calendar> * */ export default { name: 'uv-calendar', emits:['confirm','close','change'], mixins: [mpMixin, mixin, props], components: { uvHeader, uvMonth }, data() { return { // 需要显示的月份的数组 months: [], // 在月份滚动区域中,当前视图中月份的index索引 monthIndex: 0, // 月份滚动区域的高度 listHeight: 0, // month组件中选择的日期数组 selected: [], scrollIntoView: '', scrollTop:0, // 过滤处理方法 innerFormatter: (value) => value } }, watch: { selectedChange: { immediate: true, handler(n) { this.setMonth() } } }, computed: { // 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳),但是dayjs如果接受字符串形式的时间戳会有问题,这里进行处理 innerMaxDate() { return this.$uv.test.number(this.maxDate) ? Number(this.maxDate) : this.maxDate }, innerMinDate() { return this.$uv.test.number(this.minDate) ? Number(this.minDate) : this.minDate }, // 多个条件的变化,会引起选中日期的变化,这里统一管理监听 selectedChange() { return [this.innerMinDate, this.innerMaxDate, this.defaultDate] }, subtitle() { // 初始化时,this.months为空数组,所以需要特别判断处理 if (this.months.length) { return `${this.months[this.monthIndex].year}年${ this.months[this.monthIndex].month }月` } else { return '' } }, buttonDisabled() { // 如果为range类型,且选择的日期个数不足1个时,让底部的按钮出于disabled状态 if (this.mode === 'range') { if (this.selected.length <= 1) { return true } else { return false } } else { return false } } }, mounted() { this.start = Date.now() this.init() }, methods: { // 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用 setFormatter(e) { this.innerFormatter = e }, // 点击日期框触发 changeDay(e) { this.$emit('change',e); }, // month组件内部选择日期后,通过事件通知给父组件 monthSelected(e) { this.selected = e if (!this.showConfirm) { // 在不需要确认按钮的情况下,如果为单选,或者范围多选且已选长度大于2,则直接进行返还 if ( this.mode === 'multiple' || this.mode === 'single' || (this.mode === 'range' && this.selected.length >= 2) ) { this.$emit('confirm', this.selected) } } }, init() { // 校验maxDate,不能小于minDate if ( this.innerMaxDate && this.innerMinDate && new Date(this.innerMaxDate).getTime() < new Date(this.innerMinDate).getTime() ) { return this.$uv.error('maxDate不能小于minDate') } // 滚动区域的高度 this.listHeight = this.rowHeight * 5 + 30 this.setMonth() }, open() { this.setMonth() this.$refs.calendarPopup.open(); }, popupChange(e) { if(!e.show) { this.$emit('close'); } }, // 点击确定按钮 confirm() { if (!this.buttonDisabled) { this.$emit('confirm', this.selected) } if (this.closeOnClickConfirm) { this.$refs.calendarPopup.close(); } }, // 获得两个日期之间的月份数 getMonths(minDate, maxDate) { const minYear = dayjs(minDate).year() const minMonth = dayjs(minDate).month() + 1 const maxYear = dayjs(maxDate).year() const maxMonth = dayjs(maxDate).month() + 1 return (maxYear - minYear) * 12 + (maxMonth - minMonth) + 1 }, // 设置月份数据 setMonth() { // 最小日期的毫秒数 const minDate = this.innerMinDate || dayjs().valueOf() // 如果没有指定最大日期,则往后推3个月 const maxDate = this.innerMaxDate || dayjs(minDate) .add(this.monthNum - 1, 'month') .valueOf() // 最大最小月份之间的共有多少个月份, const months = this.$uv.range( 1, this.monthNum, this.getMonths(minDate, maxDate) ) // 先清空数组 this.months = [] for (let i = 0; i < months; i++) { this.months.push({ date: new Array( dayjs(minDate).add(i, 'month').daysInMonth() ) .fill(1) .map((item, index) => { // 日期,取值1-31 let day = index + 1 // 星期,0-6,0为周日 const week = dayjs(minDate) .add(i, 'month') .date(day) .day() const date = dayjs(minDate) .add(i, 'month') .date(day) .format('YYYY-MM-DD') let topInfo = '' let bottomInfo = '' if (this.showLunar) { // 将日期转为农历格式 const lunar = Calendar.solar2lunar( dayjs(date).year(), dayjs(date).month() + 1, dayjs(date).date() ) bottomInfo = lunar.IDayCn } let config = { day, week, // 小于最小允许的日期,或者大于最大的日期,则设置为disabled状态 disabled: dayjs(date).isBefore( dayjs(minDate).format('YYYY-MM-DD') ) || dayjs(date).isAfter( dayjs(maxDate).format('YYYY-MM-DD') ), // 返回一个日期对象,供外部的formatter获取当前日期的年月日等信息,进行加工处理 date: new Date(date), topInfo, bottomInfo, dot: false, month: dayjs(minDate).add(i, 'month').month() + 1 } const formatter = this.formatter || this.innerFormatter return formatter(config) }), // 当前所属的月份 month: dayjs(minDate).add(i, 'month').month() + 1, // 当前年份 year: dayjs(minDate).add(i, 'month').year() }) } }, // 滚动到默认设置的月份 scrollIntoDefaultMonth(selected) { // 查询默认日期在可选列表的下标 const _index = this.months.findIndex(({ year, month }) => { month = this.$uv.padZero(month) return `${year}-${month}` === selected }) if (_index !== -1) { // #ifndef MP-WEIXIN this.$nextTick(() => { this.scrollIntoView = `month-${_index}` }) // #endif // #ifdef MP-WEIXIN this.scrollTop = this.months[_index].top || 0; // #endif } }, // scroll-view滚动监听 onScroll(event) { // 不允许小于0的滚动值,如果scroll-view到顶了,继续下拉,会出现负数值 const scrollTop = Math.max(0, event.detail.scrollTop) // 将当前滚动条数值,除以滚动区域的高度,可以得出当前滚动到了哪一个月份的索引 for (let i = 0; i < this.months.length; i++) { if (scrollTop >= (this.months[i].top || this.listHeight)) { this.monthIndex = i } } }, // 更新月份的top值 updateMonthTop(topArr = []) { // 设置对应月份的top值,用于onScroll方法更新月份 topArr.map((item, index) => { this.months[index].top = item }) // 获取默认日期的下标 if (!this.defaultDate) { // 如果没有设置默认日期,则将当天日期设置为默认选中的日期 const selected = dayjs().format("YYYY-MM") this.scrollIntoDefaultMonth(selected) return } let selected = dayjs().format("YYYY-MM"); // 单选模式,可以是字符串或数组,Date对象等 if (!this.$uv.test.array(this.defaultDate)) { selected = dayjs(this.defaultDate).format("YYYY-MM") } else { selected = dayjs(this.defaultDate[0]).format("YYYY-MM"); } this.scrollIntoDefaultMonth(selected) } } } </script> <style lang="scss" scoped> .uv-calendar { &__confirm { padding: 7px 18px; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendar/components/uv-calendar/uv-calendar.vue
Vue
unknown
12,799
<template> <view class="uv-calendar-body"> <view class="uv-calendar__header"> <view class="uv-calendar__header-btn-box" @click.stop="pre"> <view class="uv-calendar__header-btn uv-calendar--left"></view> </view> <picker mode="date" :value="getDate" fields="month" @change="bindDateChange"> <text class="uv-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text> </picker> <view class="uv-calendar__header-btn-box" @click.stop="next"> <view class="uv-calendar__header-btn uv-calendar--right"></view> </view> <text class="uv-calendar__backtoday" @click="backToday">{{todayText}}</text> </view> <view class="uv-calendar__box"> <view v-if="showMonth" class="uv-calendar__box-bg"> <text class="uv-calendar__box-bg-text">{{nowDate.month}}</text> </view> <view class="uv-calendar__weeks uv-calendar__weeks-week"> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{SUNText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{monText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{TUEText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{WEDText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{THUText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{FRIText}}</text> </view> <view class="uv-calendar__weeks-day"> <text class="uv-calendar__weeks-day-text">{{SATText}}</text> </view> </view> <view class="uv-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> <view class="uv-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex"> <calendar-item class="uv-calendar-item--hook" :weeks="weeks" :rangeInfoText="rangeInfoText(weeks)" :multiple="multiple" :range="range" :calendar="calendar" :selected="selected" :lunar="lunar" :color="color" @change="choiceDate"></calendar-item> </view> </view> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'; import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'; import CalendarItem from './calendar-item.vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; import i18nMessages from './i18n/index.js'; const { t } = initVueI18n(i18nMessages); export default { mixins: [mpMixin, mixin], components: { CalendarItem }, props: { date: { type: [String,Array], default: '' }, nowDate: { type: [String, Object], default: '' }, weeks: { type: [Array, Object], default () { return [] } }, calendar: { type: Object, default () { return {} } }, selected: { type: Array, default () { return [] } }, lunar: { type: Boolean, default: false }, showMonth: { type: Boolean, default: true }, color: { type: String, default: '#3c9cff' }, startText: { type: String, default: '开始' }, endText: { type: String, default: '结束' }, range: { type: Boolean, default: false }, multiple: { type: Boolean, default: false }, // 是否允许日期范围的起止时间为同一天,mode = range时有效 allowSameDay: { type: Boolean, default: false } }, computed: { getDate() { return Array.isArray(this.date) ? this.date[0] : this.date; }, /** * for i18n */ todayText() { return t("uv-calender.today") }, monText() { return t("uv-calender.MON") }, TUEText() { return t("uv-calender.TUE") }, WEDText() { return t("uv-calender.WED") }, THUText() { return t("uv-calender.THU") }, FRIText() { return t("uv-calender.FRI") }, SATText() { return t("uv-calender.SAT") }, SUNText() { return t("uv-calender.SUN") }, rangeInfoText(weeks) { return weeks=> { if(this.allowSameDay && weeks.beforeRange && weeks.afterRange && weeks.dateEqual) { return this.setInfo(weeks,`${this.startText}/${this.endText}`); } if(weeks.beforeRange) { return this.setInfo(weeks,this.startText); } if(weeks.afterRange) { return this.setInfo(weeks,this.endText); } if(weeks.extraInfo?.info_old == ' ') { weeks.extraInfo.info = null; }else if(weeks.extraInfo?.info_old) { weeks.extraInfo.info = weeks.extraInfo.info_old; } } } }, methods: { setInfo(weeks,text) { this.setInfoOld(weeks); if(weeks.extraInfo) { weeks.extraInfo.info = text; }else { weeks.extraInfo = { info: text } } }, setInfoOld(weeks) { if(weeks.extraInfo) { weeks.extraInfo.info_old = weeks.extraInfo.info ? weeks.extraInfo.info_old || weeks.extraInfo.info : ' '; } }, bindDateChange(e) { this.$emit('bindDateChange', e); }, backToday() { this.$emit('backToday'); }, pre() { this.$emit('pre'); }, next() { this.$emit('next'); }, choiceDate(e) { this.$emit('choiceDate', e); } } } </script> <style scoped lang="scss"> @mixin flex($direction: row) { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: $direction; } $uv-bg-color-mask: rgba($color: #000000, $alpha: 0.4); $uv-border-color: #EDEDED !default; $uv-text-color: #333; $uv-bg-color-hover: #f1f1f1; $uv-font-size-base: 14px; $uv-text-color-placeholder: #808080; $uv-color-subtitle: #555555; $uv-text-color-grey: #999; .uv-calendar { @include flex(column); } .uv-calendar__mask { position: fixed; bottom: 0; top: 0; left: 0; right: 0; background-color: $uv-bg-color-mask; transition-property: opacity; transition-duration: 0.3s; opacity: 0; /* #ifndef APP-NVUE */ z-index: 99; /* #endif */ } .uv-calendar--mask-show { opacity: 1 } .uv-calendar--fixed { position: fixed; /* #ifdef APP-NVUE */ bottom: 0; /* #endif */ left: 0; right: 0; transition-property: transform; transition-duration: 0.3s; transform: translateY(460px); /* #ifndef APP-NVUE */ bottom: calc(var(--window-bottom)); z-index: 99; /* #endif */ } .uv-calendar--ani-show { transform: translateY(0); } .uv-calendar__content { background-color: #fff; } .uv-calendar__header { position: relative; @include flex; justify-content: center; align-items: center; height: 50px; border-bottom-color: $uv-border-color; border-bottom-style: solid; border-bottom-width: 1px; } .uv-calendar--fixed-top { @include flex; justify-content: space-between; border-top-color: $uv-border-color; border-top-style: solid; border-top-width: 1px; } .uv-calendar--fixed-width { width: 50px; } .uv-calendar__backtoday { position: absolute; right: 0; top: 25rpx; padding: 0 5px; padding-left: 10px; height: 25px; line-height: 25px; font-size: 12px; border-top-left-radius: 25px; border-bottom-left-radius: 25px; color: $uv-text-color; background-color: $uv-bg-color-hover; } .uv-calendar__header-text { text-align: center; width: 100px; font-size: $uv-font-size-base; color: $uv-text-color; } .uv-calendar__header-btn-box { @include flex; align-items: center; justify-content: center; width: 50px; height: 50px; } .uv-calendar__header-btn { width: 10px; height: 10px; border-left-color: $uv-text-color-placeholder; border-left-style: solid; border-left-width: 2px; border-top-color: $uv-color-subtitle; border-top-style: solid; border-top-width: 2px; } .uv-calendar--left { transform: rotate(-45deg); } .uv-calendar--right { transform: rotate(135deg); } .uv-calendar__weeks { position: relative; @include flex; } .uv-calendar__weeks-week { padding: 0 0 2rpx; } .uv-calendar__weeks-item { flex: 1; } .uv-calendar__weeks-day { flex: 1; @include flex(column); justify-content: center; align-items: center; height: 45px; border-bottom-color: #F5F5F5; border-bottom-style: solid; border-bottom-width: 1px; } .uv-calendar__weeks-day-text { font-size: 14px; } .uv-calendar__box { position: relative; } .uv-calendar__box-bg { @include flex(column); justify-content: center; align-items: center; position: absolute; top: 0; left: 0; right: 0; bottom: 0; } .uv-calendar__box-bg-text { font-size: 200px; font-weight: bold; color: $uv-text-color-grey; opacity: 0.1; text-align: center; /* #ifndef APP-NVUE */ line-height: 1; /* #endif */ } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/calendar-body.vue
Vue
unknown
8,782
<template> <view class="uv-calendar-item__weeks-box" :class="{ 'uv-calendar-item--disable':weeks.disable || (weeks.extraInfo&&weeks.extraInfo.disable), 'uv-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay && !multiple, 'uv-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay && !multiple) , 'uv-calendar-item--before-checked':weeks.beforeRange, 'uv-calendar-item--range': weeks.range, 'uv-calendar-item--after-checked':weeks.afterRange, 'uv-calendar-item--multiple':weeks.multiple }" :style="[itemBoxStyle]" @click="choiceDate(weeks)"> <view class="uv-calendar-item__weeks-box-item"> <text v-if="selected&&weeks.extraInfo&&weeks.extraInfo.badge" class="uv-calendar-item__weeks-box-circle"></text> <text class="uv-calendar-item__weeks-top-text" v-if="weeks.extraInfo&&weeks.extraInfo.topinfo" :style="[infoStyle('top')]">{{weeks.extraInfo&&weeks.extraInfo.topinfo}}</text> <text class="uv-calendar-item__weeks-box-text" :class="{ 'uv-calendar-item--isDay-text': weeks.isDay, 'uv-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay && !multiple, 'uv-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay && !multiple, 'uv-calendar-item--before-checked':weeks.beforeRange, 'uv-calendar-item--range': weeks.range, 'uv-calendar-item--after-checked':weeks.afterRange, 'uv-calendar-item--multiple':weeks.multiple, 'uv-calendar-item--disable':weeks.disable || (weeks.extraInfo&&weeks.extraInfo.disable) }" :style="[itemBoxStyle]">{{weeks.date}}</text> <text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uv-calendar-item__weeks-lunar-text" :class="{ 'uv-calendar-item--isDay-text':weeks.isDay, 'uv-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay && !multiple, 'uv-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay && !multiple, 'uv-calendar-item--before-checked':weeks.beforeRange, 'uv-calendar-item--range': weeks.range, 'uv-calendar-item--after-checked':weeks.afterRange, 'uv-calendar-item--multiple':weeks.multiple }" :style="[itemBoxStyle]">{{todayText}}</text> <text v-if="lunar&&!weeks.extraInfo" class="uv-calendar-item__weeks-lunar-text" :class="{ 'uv-calendar-item--isDay-text':weeks.isDay, 'uv-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay && !multiple, 'uv-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay && !multiple, 'uv-calendar-item--before-checked':weeks.beforeRange, 'uv-calendar-item--range': weeks.range, 'uv-calendar-item--after-checked':weeks.afterRange, 'uv-calendar-item--multiple':weeks.multiple, 'uv-calendar-item--disable':weeks.disable || (weeks.extraInfo&&weeks.extraInfo.disable) }" :style="[itemBoxStyle]">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text> <text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uv-calendar-item__weeks-lunar-text" :class="{ 'uv-calendar-item__weeks-lunar-text--equal': weeks.dateEqual }" :style="[infoStyle('bottom')]">{{weeks.extraInfo.info}}</text> </view> </view> </template> <script> import { colorGradient } from '@/uni_modules/uv-ui-tools/libs/function/colorGradient.js'; import { initVueI18n } from '@dcloudio/uni-i18n' import i18nMessages from './i18n/index.js' const { t } = initVueI18n(i18nMessages) export default { emits: ['change'], props: { weeks: { type: Object, default () { return {} } }, calendar: { type: Object, default: () => { return {} } }, selected: { type: Array, default: () => { return [] } }, lunar: { type: Boolean, default: false }, color: { type: String, default: '#3c9cff' }, range: { type: Boolean, default: false }, multiple: { type: Boolean, default: false } }, computed: { todayText() { return t("uv-calender.today") }, itemBoxStyle() { const style = {}; if (this.multiple) { // 多选状态 if (this.weeks.multiple) { style.backgroundColor = this.color; style.color = '#fff'; } else if (this.weeks.isDay) { style.color = this.color; } } else if (this.range) { // 范围选择 if (this.weeks.beforeRange || this.weeks.afterRange) { style.backgroundColor = this.color; } else if (this.weeks.range) { style.backgroundColor = colorGradient(this.color, '#ffffff', 100)[90] style.color = this.color; style.opacity = 0.8; style.borderRadius = 0; } } else { if (this.weeks.isDay) { style.color = this.color; } if (this.calendar.fullDate === this.weeks.fullDate) { style.backgroundColor = this.color; style.color = '#fff'; } } return style; }, infoStyle(val) { return val => { const style = {}; if (!this.weeks.multiple) { if (val == 'top') { style.color = this.weeks.extraInfo.topinfoColor ? this.weeks.extraInfo.topinfoColor : '#606266'; } else if (val == 'bottom') { style.color = this.weeks.extraInfo.infoColor ? this.weeks.extraInfo.infoColor : '#f56c6c'; } if (this.weeks.range) { style.color = this.color; } if (this.calendar.fullDate === this.weeks.fullDate || this.weeks.beforeRange || this.weeks.afterRange) { style.color = this.multiple ? style.color : '#fff'; } } else { style.color = '#fff'; } return style; } } }, methods: { choiceDate(weeks) { if (this.weeks.extraInfo && this.weeks.extraInfo.disable) return; this.$emit('change', weeks) } } } </script> <style lang="scss" scoped> @mixin flex($direction: row) { /* #ifndef APP-NVUE */ display: flex; /* #endif */ flex-direction: $direction; } $uv-font-size-base: 14px; $uv-text-color: #333; $uv-font-size-sm: 24rpx; $uv-error: #f56c6c !default; $uv-opacity-disabled: 0.3; $uv-text-color-disable: #c0c0c0; $uv-primary: #3c9cff !default; $info-height: 32rpx; .uv-calendar-item__weeks-box { flex: 1; @include flex(column); justify-content: center; align-items: center; border-radius: 4px; } .uv-calendar-item__weeks-top-text { height: $info-height; line-height: $info-height; font-size: $uv-font-size-sm; } .uv-calendar-item__weeks-box-text { font-size: $uv-font-size-base; color: $uv-text-color; } .uv-calendar-item__weeks-lunar-text { height: $info-height; line-height: $info-height; font-size: $uv-font-size-sm; color: $uv-text-color; } .uv-calendar-item__weeks-lunar-text--equal { /* #ifdef H5 */ white-space: nowrap; transform: scale(.8); /* #endif */ /* #ifndef H5 */ font-size: 20rpx; /* #endif */ } .uv-calendar-item__weeks-box-item { position: relative; @include flex(column); justify-content: center; align-items: center; width: 106rpx; height: 56px; } .uv-calendar-item__weeks-box-circle { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 8px; background-color: $uv-error; } .uv-calendar-item--disable { background-color: rgba(249, 249, 249, $uv-opacity-disabled); color: $uv-text-color-disable; } .uv-calendar-item--isDay-text { color: $uv-primary; } .uv-calendar-item--isDay { background-color: $uv-primary; color: #fff; } .uv-calendar-item--checked { background-color: $uv-primary; color: #fff; border-radius: 4px; } // .uv-calendar-item--range { // background-color: $uv-primary; // color: #fff; // } .uv-calendar-item--before-checked { color: #fff; } .uv-calendar-item--after-checked { color: #fff; } .uv-calendar-item--multiple { background-color: $uv-primary; color: #fff; } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/calendar-item.vue
Vue
unknown
7,886
/** * @1900-2100区间内的公历、农历互转 * @charset UTF-8 * @github https://github.com/jjonline/calendar.js * @Author Jea杨(JJonline@JJonline.Cn) * @Time 2014-7-21 * @Time 2016-8-13 Fixed 2033hex、Attribution Annals * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year * @Version 1.0.3 * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] */ /* eslint-disable */ var calendar = { /** * 农历1900-2100的润大小信息表 * @Array Of Property * @return Hex */ lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 /** Add By JJonline@JJonline.Cn**/ 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 0x0d520], // 2100 /** * 公历每个月份的天数普通表 * @Array Of Property * @return Number */ solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], /** * 天干地支之天干速查表 * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] * @return Cn string */ Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], /** * 天干地支之地支速查表 * @Array Of Property * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] * @return Cn string */ Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], /** * 天干地支之地支速查表<=>生肖 * @Array Of Property * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] * @return Cn string */ Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], /** * 24节气速查表 * @Array Of Property * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] * @return Cn string */ solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], /** * 1900-2100各年的24节气日期速查表 * @Array Of Property * @return 0x string For splice */ sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], /** * 数字转中文速查表 * @Array Of Property * @trans ['日','一','二','三','四','五','六','七','八','九','十'] * @return Cn string */ nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], /** * 日期转农历称呼速查表 * @Array Of Property * @trans ['初','十','廿','卅'] * @return Cn string */ nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], /** * 月份转农历称呼速查表 * @Array Of Property * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] * @return Cn string */ nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], /** * 返回农历y年一整年的总天数 * @param lunar Year * @return Number * @eg:var count = calendar.lYearDays(1987) ;//count=387 */ lYearDays: function (y) { var i; var sum = 348 for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } return (sum + this.leapDays(y)) }, /** * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 * @param lunar Year * @return Number (0-12) * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 */ leapMonth: function (y) { // 闰字编码 \u95f0 return (this.lunarInfo[y - 1900] & 0xf) }, /** * 返回农历y年闰月的天数 若该年没有闰月则返回0 * @param lunar Year * @return Number (0、29、30) * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 */ leapDays: function (y) { if (this.leapMonth(y)) { return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) } return (0) }, /** * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 * @param lunar Year * @return Number (-1、29、30) * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 */ monthDays: function (y, m) { if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1 return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) }, /** * 返回公历(!)y年m月的天数 * @param solar Year * @return Number (-1、28、29、30、31) * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 */ solarDays: function (y, m) { if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 var ms = m - 1 if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29 return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) } else { return (this.solarMonth[ms]) } }, /** * 农历年份转换为干支纪年 * @param lYear 农历年的年份数 * @return Cn string */ toGanZhiYear: function (lYear) { var ganKey = (lYear - 3) % 10 var zhiKey = (lYear - 3) % 12 if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干 if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支 return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] }, /** * 公历月、日判断所属星座 * @param cMonth [description] * @param cDay [description] * @return Cn string */ toAstro: function (cMonth, cDay) { var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座 }, /** * 传入offset偏移量返回干支 * @param offset 相对甲子的偏移量 * @return Cn string */ toGanZhi: function (offset) { return this.Gan[offset % 10] + this.Zhi[offset % 12] }, /** * 传入公历(!)y年获得该年第n个节气的公历日期 * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 * @return day Number * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 */ getTerm: function (y, n) { if (y < 1900 || y > 2100) { return -1 } if (n < 1 || n > 24) { return -1 } var _table = this.sTermInfo[y - 1900] var _info = [ parseInt('0x' + _table.substr(0, 5)).toString(), parseInt('0x' + _table.substr(5, 5)).toString(), parseInt('0x' + _table.substr(10, 5)).toString(), parseInt('0x' + _table.substr(15, 5)).toString(), parseInt('0x' + _table.substr(20, 5)).toString(), parseInt('0x' + _table.substr(25, 5)).toString() ] var _calday = [ _info[0].substr(0, 1), _info[0].substr(1, 2), _info[0].substr(3, 1), _info[0].substr(4, 2), _info[1].substr(0, 1), _info[1].substr(1, 2), _info[1].substr(3, 1), _info[1].substr(4, 2), _info[2].substr(0, 1), _info[2].substr(1, 2), _info[2].substr(3, 1), _info[2].substr(4, 2), _info[3].substr(0, 1), _info[3].substr(1, 2), _info[3].substr(3, 1), _info[3].substr(4, 2), _info[4].substr(0, 1), _info[4].substr(1, 2), _info[4].substr(3, 1), _info[4].substr(4, 2), _info[5].substr(0, 1), _info[5].substr(1, 2), _info[5].substr(3, 1), _info[5].substr(4, 2) ] return parseInt(_calday[n - 1]) }, /** * 传入农历数字月份返回汉语通俗表示法 * @param lunar month * @return Cn string * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' */ toChinaMonth: function (m) { // 月 => \u6708 if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 var s = this.nStr3[m - 1] s += '\u6708'// 加上月字 return s }, /** * 传入农历日期数字返回汉字表示法 * @param lunar day * @return Cn string * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' */ toChinaDay: function (d) { // 日 => \u65e5 var s switch (d) { case 10: s = '\u521d\u5341'; break case 20: s = '\u4e8c\u5341'; break break case 30: s = '\u4e09\u5341'; break break default : s = this.nStr2[Math.floor(d / 10)] s += this.nStr1[d % 10] } return (s) }, /** * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” * @param y year * @return Cn string * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' */ getAnimal: function (y) { return this.Animals[(y - 4) % 12] }, /** * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON * @param y solar year * @param m solar month * @param d solar day * @return JSON object * @eg:console.log(calendar.solar2lunar(1987,11,01)); */ solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31 // 年份限定、上限 if (y < 1900 || y > 2100) { return -1// undefined转换为数字变为NaN } // 公历传参最下限 if (y == 1900 && m == 1 && d < 31) { return -1 } // 未传参 获得当天 if (!y) { var objDate = new Date() } else { var objDate = new Date(y, parseInt(m) - 1, d) } var i; var leap = 0; var temp = 0 // 修正ymd参数 var y = objDate.getFullYear() var m = objDate.getMonth() + 1 var d = objDate.getDate() var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 for (i = 1900; i < 2101 && offset > 0; i++) { temp = this.lYearDays(i) offset -= temp } if (offset < 0) { offset += temp; i-- } // 是否今天 var isTodayObj = new Date() var isToday = false if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { isToday = true } // 星期几 var nWeek = objDate.getDay() var cWeek = this.nStr1[nWeek] // 数字表示周几顺应天朝周一开始的惯例 if (nWeek == 0) { nWeek = 7 } // 农历年 var year = i var leap = this.leapMonth(i) // 闰哪个月 var isLeap = false // 效验闰月 for (i = 1; i < 13 && offset > 0; i++) { // 闰月 if (leap > 0 && i == (leap + 1) && isLeap == false) { --i isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数 } else { temp = this.monthDays(year, i)// 计算农历普通月天数 } // 解除闰月 if (isLeap == true && i == (leap + 1)) { isLeap = false } offset -= temp } // 闰月导致数组下标重叠取反 if (offset == 0 && leap > 0 && i == leap + 1) { if (isLeap) { isLeap = false } else { isLeap = true; --i } } if (offset < 0) { offset += temp; --i } // 农历月 var month = i // 农历日 var day = offset + 1 // 天干地支处理 var sm = m - 1 var gzY = this.toGanZhiYear(year) // 当月的两个节气 // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始 var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始 // 依据12节气修正干支月 var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) if (d >= firstNode) { gzM = this.toGanZhi((y - 1900) * 12 + m + 12) } // 传入的日期的节气与否 var isTerm = false var Term = null if (firstNode == d) { isTerm = true Term = this.solarTerm[m * 2 - 2] } if (secondNode == d) { isTerm = true Term = this.solarTerm[m * 2 - 1] } // 日柱 当月一日与 1900/1/1 相差天数 var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 var gzD = this.toGanZhi(dayCyclical + d - 1) // 该日期所属的星座 var astro = this.toAstro(m, d) return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } }, /** * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON * @param y lunar year * @param m lunar month * @param d lunar day * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] * @return JSON object * @eg:console.log(calendar.lunar2solar(1987,9,10)); */ lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1 var isLeapMonth = !!isLeapMonth var leapOffset = 0 var leapMonth = this.leapMonth(y) var leapDay = this.leapDays(y) if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值 var day = this.monthDays(y, m) var _day = day // bugFix 2016-9-25 // if month is leap, _day use leapDays method if (isLeapMonth) { _day = this.leapDays(y, m) } if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验 // 计算农历的时间差 var offset = 0 for (var i = 1900; i < y; i++) { offset += this.lYearDays(i) } var leap = 0; var isAdd = false for (var i = 1; i < m; i++) { leap = this.leapMonth(y) if (!isAdd) { // 处理闰月 if (leap <= i && leap > 0) { offset += this.leapDays(y); isAdd = true } } offset += this.monthDays(y, i) } // 转换闰月农历 需补充该年闰月的前一个月的时差 if (isLeapMonth) { offset += day } // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) var calObj = new Date((offset + d - 31) * 86400000 + stmap) var cY = calObj.getUTCFullYear() var cM = calObj.getUTCMonth() + 1 var cD = calObj.getUTCDate() return this.solar2lunar(cY, cM, cD) } } export default calendar
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/calendar.js
JavaScript
unknown
24,849
import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' export default { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant }
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/i18n/index.js
JavaScript
unknown
162
import CALENDAR from './calendar.js' class Calendar { constructor({ date, selected, startDate, endDate, range, multiple, allowSameDay } = {}) { // 当前日期 this.date = this.getDate(new Date()) // 当前初入日期 // 打点信息 this.selected = selected || []; // 范围开始 this.startDate = startDate // 范围结束 this.endDate = endDate this.range = range this.multiple = multiple this.allowSameDay = allowSameDay // 多选状态 this.cleanRangeStatus() // 范围状态 this.cleanMultipleStatus() // 每周日期 this.weeks = {} // this._getWeek(this.date.fullDate) } /** * 设置日期 * @param {Object} date */ setDate(date, status) { if (this.range && status == 'init') { this.cleanRangeStatus(); if (Array.isArray(date)) { this.rangeStatus.before = date[0]; this.rangeStatus.after = date.length > 1 ? date[date.length - 1] : ''; if (this.rangeStatus.after && this.dateCompare(this.rangeStatus.before, this.rangeStatus.after)) { this.rangeStatus.data = this.geDateAll(this.rangeStatus.before, this.rangeStatus.after) } this.selectDate = this.getDate(date[0]) this._getWeek(this.selectDate.fullDate) } else { this.selectDate = this.getDate(date) this.rangeStatus.before = this.selectDate.fullDate; this._getWeek(this.selectDate.fullDate) } } else if (this.multiple && status == 'init') { this.cleanMultipleStatus(); if (Array.isArray(date)) { this.multipleStatus.data = date; this.selectDate = this.getDate(date[0]) this._getWeek(this.selectDate.fullDate) } else { this.selectDate = this.getDate(date) this.multipleStatus.data = [this.selectDate.fullDate]; this._getWeek(this.selectDate.fullDate) } } else { if (Array.isArray(date)) { this.selectDate = this.getDate(date[0]) this._getWeek(this.selectDate.fullDate) } else { this.selectDate = this.getDate(date) this._getWeek(this.selectDate.fullDate) } } } /** * 清理多选状态 */ cleanRangeStatus() { this.rangeStatus = { before: '', after: '', data: [] } } /** * 清理多选状态 */ cleanMultipleStatus() { this.multipleStatus = { data: [] } } /** * 重置开始日期 */ resetSatrtDate(startDate) { // 范围开始 this.startDate = startDate } /** * 重置结束日期 */ resetEndDate(endDate) { // 范围结束 this.endDate = endDate } /** * 获取任意时间 */ getDate(date, AddDayCount = 0, str = 'day') { if (!date) { date = new Date() } if (typeof date !== 'object') { date = date.replace(/-/g, '/') } const dd = new Date(date) switch (str) { case 'day': dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 break case 'month': if (dd.getDate() === 31 && AddDayCount > 0) { dd.setDate(dd.getDate() + AddDayCount) } else { const preMonth = dd.getMonth() dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期 const nextMonth = dd.getMonth() // 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) { dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount)) } // 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题 if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) { dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount)) } } break case 'year': dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 break } const y = dd.getFullYear() const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0 return { fullDate: y + '-' + m + '-' + d, year: y, month: m, date: d, day: dd.getDay() } } /** * 获取上月剩余天数 */ _getLastMonthDays(firstDay, full) { let dateArr = [] for (let i = firstDay; i > 0; i--) { const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() dateArr.push({ date: beforeDate, month: full.month - 1, lunar: this.getlunar(full.year, full.month - 1, beforeDate), disable: true }) } return dateArr } /** * 获取本月天数 */ _currentMonthDys(dateData, full) { let dateArr = [] let fullDate = this.date.fullDate for (let i = 1; i <= dateData; i++) { let nowDate = full.year + '-' + (full.month < 10 ? full.month : full.month) + '-' + (i < 10 ? '0' + i : i) // 是否今天 let isDay = fullDate === nowDate // 获取打点信息 let info = this.selected && this.selected.find((item) => { if (this.dateEqual(nowDate, item.date)) { return item } }) // 日期禁用 let disableBefore = true let disableAfter = true if (this.startDate) { // let dateCompBefore = this.dateCompare(this.startDate, fullDate) // disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) disableBefore = this.dateCompare(this.startDate, nowDate) } if (this.endDate) { // let dateCompAfter = this.dateCompare(fullDate, this.endDate) // disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) disableAfter = this.dateCompare(nowDate, this.endDate) } let ranges = this.rangeStatus.data let checked = false let rangesStatus = -1 if (this.range) { if (ranges) { rangesStatus = ranges.findIndex((item) => { return this.dateEqual(item, nowDate) }) } if (rangesStatus !== -1) { checked = true } } let multiples = this.multipleStatus.data let checked_multiple = false let multiplesStatus = -1 if (this.multiple) { if (multiples) { multiplesStatus = multiples.findIndex((item) => { return this.dateEqual(item, nowDate) }) } if (multiplesStatus !== -1) { checked_multiple = true } } let data = { fullDate: nowDate, year: full.year, date: i, range: this.range ? checked : false, multiple: this.multiple ? checked_multiple : false, beforeRange: this.dateEqual(this.rangeStatus.before, nowDate), afterRange: this.dateEqual(this.rangeStatus.after, nowDate), dateEqual: this.range && checked && this.dateEqual(this.rangeStatus.before, this.rangeStatus.after), month: full.month, lunar: this.getlunar(full.year, full.month, i), disable: !(disableBefore && disableAfter), isDay } if (info) { data.extraInfo = info } dateArr.push(data) } return dateArr } /** * 获取下月天数 */ _getNextMonthDays(surplus, full) { let dateArr = [] for (let i = 1; i < surplus + 1; i++) { dateArr.push({ date: i, month: Number(full.month) + 1, lunar: this.getlunar(full.year, Number(full.month) + 1, i), disable: true }) } return dateArr } /** * 获取当前日期详情 * @param {Object} date */ getInfo(date) { if (!date) { date = new Date() } else if (Array.isArray(date)) { date = date[0] } const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) return dateInfo } /** * 比较时间大小 */ dateCompare(startDate, endDate) { // 计算截止时间 startDate = new Date(startDate.replace('-', '/').replace('-', '/')) // 计算详细项的截止时间 endDate = new Date(endDate.replace('-', '/').replace('-', '/')) if (startDate <= endDate) { return true } else { return false } } /** * 比较时间是否相等 */ dateEqual(before, after) { // 计算截止时间 before = new Date(before.replace('-', '/').replace('-', '/')) // 计算详细项的截止时间 after = new Date(after.replace('-', '/').replace('-', '/')) if (before.getTime() - after.getTime() === 0) { return true } else { return false } } /** * 比较after时间是否大于before时间 */ dateAfterLgBefore(before, after) { // 计算截止时间 before = new Date(before.replace('-', '/').replace('-', '/')) // 计算详细项的截止时间 after = new Date(after.replace('-', '/').replace('-', '/')) if (after.getTime() - before.getTime() > 0) { return true } else { return false } } /** * 获取日期范围内所有日期 * @param {Object} begin * @param {Object} end */ geDateAll(begin, end) { var arr = [] var ab = begin.split('-') var ae = end.split('-') var db = new Date() db.setFullYear(ab[0], ab[1] - 1, ab[2]) var de = new Date() de.setFullYear(ae[0], ae[1] - 1, ae[2]) var unixDb = db.getTime() - 24 * 60 * 60 * 1000 var unixDe = de.getTime() - 24 * 60 * 60 * 1000 for (var k = unixDb; k <= unixDe;) { k = k + 24 * 60 * 60 * 1000 arr.push(this.getDate(new Date(parseInt(k))).fullDate) } return arr } /** * 计算阴历日期显示 */ getlunar(year, month, date) { return CALENDAR.solar2lunar(year, month, date) } /** * 设置打点 */ setSelectInfo(data, value) { this.selected = value this._getWeek(data) } /** * 获取多选状态 */ setMultiple(fullDate) { if (!this.multiple) return let multiples = this.multipleStatus.data; const findIndex = multiples.findIndex(item => this.dateEqual(fullDate, item)); if (findIndex < 0) { this.multipleStatus.data = this.multipleStatus.data.concat([fullDate]); } else { this.multipleStatus.data.splice(findIndex, 1); } this._getWeek(fullDate) } /** * 获取范围状态 */ setRange(fullDate) { let { before, after } = this.rangeStatus if (!this.range) return if (before && after) { this.cleanRangeStatus(); this.rangeStatus.before = fullDate } else { if (!before) { this.rangeStatus.before = fullDate } else { if (this.allowSameDay && this.dateEqual(before, fullDate)) { this.rangeStatus.after = fullDate } else if (!this.dateAfterLgBefore(this.rangeStatus.before, fullDate)) { this.cleanRangeStatus(); this.rangeStatus.before = fullDate this._getWeek(fullDate) return; } this.rangeStatus.after = fullDate if (this.dateCompare(this.rangeStatus.before, this.rangeStatus.after)) { this.rangeStatus.data = this.geDateAll(this.rangeStatus.before, this.rangeStatus.after); } else { this.rangeStatus.data = this.geDateAll(this.rangeStatus.after, this.rangeStatus.before); } } } this._getWeek(fullDate) } /** * 获取每周数据 * @param {Object} dateData */ _getWeek(dateData) { const { year, month } = this.getDate(dateData) let firstDay = new Date(year, month - 1, 1).getDay() let currentDay = new Date(year, month, 0).getDate() let dates = { lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数 nextMonthDays: [], // 下个月开始几天 weeks: [] } let canlender = [] const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) let weeks = {} // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 for (let i = 0; i < canlender.length; i++) { if (i % 7 === 0) { weeks[parseInt(i / 7)] = new Array(7) } weeks[parseInt(i / 7)][i % 7] = canlender[i] } this.canlender = canlender this.weeks = weeks } //静态方法 // static init(date) { // if (!this.instance) { // this.instance = new Calendar(date); // } // return this.instance; // } } export default Calendar
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/util.js
JavaScript
unknown
11,902
<template> <view class="uv-calendar"> <view class="uv-calendar__content" v-if="insert"> <calendar-body :date="date" :nowDate="nowDate" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" :showMonth="showMonth" :color="color" :startText="startText" :endText="endText" :range="range" :multiple="multiple" :allowSameDay="allowSameDay" @bindDateChange="bindDateChange" @pre="pre" @next="next" @backToday="backToday" @choiceDate="choiceDate" ></calendar-body> </view> <uv-popup ref="popup" mode="bottom" v-else :round="round" z-index="998" :close-on-click-overlay="closeOnClickOverlay" @maskClick="maskClick"> <view style="min-height: 100px;"> <uv-toolbar :show="true" :cancelColor="cancelColor" :confirmColor="getConfirmColor" :cancelText="cancelText" :confirmText="confirmText" :title="title" @cancel="close" @confirm="confirm"></uv-toolbar> <view class="line"></view> <calendar-body :nowDate="nowDate" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" :showMonth="showMonth" :color="color" :startText="startText" :endText="endText" :range="range" :multiple="multiple" :allowSameDay="allowSameDay" @bindDateChange="bindDateChange" @pre="pre" @next="next" @backToday="backToday" @choiceDate="choiceDate" ></calendar-body> </view> </uv-popup> </view> </template> <script> /** * Calendar 日历 * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 * @tutorial https://ext.dcloud.net.cn/plugin?name=uv-calendar * @property {String} date 自定义当前时间,默认为今天 * @property {Boolean} lunar 显示农历 * @property {String} startDate 日期选择范围-开始日期 * @property {String} endDate 日期选择范围-结束日期 * @property {String} mode = [不传 | multiple | range ] 多个日期 | 选择日期范围 默认单日期 * @property {Boolean} insert = [true|false] 插入模式,默认为false * @value true 弹窗模式 * @value false 插入模式 * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] * @property {String} cancelColor 取消按钮颜色 * @property {String} confirmColor 确认按钮颜色,默认#3c9cff * @property {String} title 头部工具条中间的标题文字 * @property {String} color 主题色,默认#3c9cff * @property {Number} round :insert="false"时的圆角 * @property {Boolean} closeOnClickOverlay 点击遮罩是否关闭 * @property {String} startText range为true时,第一个日期底部的提示文字 * @property {String} endText range为true时,最后一个日期底部的提示文字 * @property {String} readonly 是否为只读状态,只读状态下禁止选择日期,默认false * * @event {Function} change 日期改变,`insert :ture` 时生效 * @event {Function} confirm 确认选择`insert :false` 时生效 * @event {Function} monthSwitch 切换月份时触发 * * @example <uv-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" /> */ import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'; import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'; import Calendar from './util.js'; import calendarBody from './calendar-body.vue'; import { initVueI18n } from '@dcloudio/uni-i18n'; import i18nMessages from './i18n/index.js'; const { t } = initVueI18n(i18nMessages); export default { components: { calendarBody }, mixins: [mpMixin, mixin], emits: ['close', 'confirm', 'change', 'monthSwitch'], props: { // 取消按钮颜色 cancelColor: { type: String, default: '' }, // 确认按钮颜色,range模式下未选全显示灰色 confirmColor: { type: String, default: '#3c9cff' }, // 标题 title: { type: String, default: '' }, // 主题色 color: { type: String, default: '#3c9cff' }, // 默认显示日期 date: { type: [String,Array], default: '' }, // 打点等设置 selected: { type: Array, default () { return [] } }, // 是否显示农历 lunar: { type: Boolean, default: false }, // 可选择的起始日期 startDate: { type: String, default: '' }, // 可选择的结束日期 endDate: { type: String, default: '' }, // multiple - 选择多日期 range - 选择日期范围 mode: { type: String, default: '' }, // 是否插入模式 insert: { type: Boolean, default: false }, // 是否显示月份为背景 showMonth: { type: Boolean, default: true }, // 弹窗模式是否清空上次选择内容 clearDate: { type: Boolean, default: true }, // 弹窗圆角 round: { type: [Number,String], default: 8 }, // 点击遮罩是否关闭弹窗 closeOnClickOverlay: { type: Boolean, default: true }, // range为true时,第一个日期底部的提示文字 startText: { type: String, default: '开始' }, // range为true时,最后一个日期底部的提示文字 endText: { type: String, default: '结束' }, // 是否允许日期范围的起止时间为同一天,mode = range时有效 allowSameDay: { type: Boolean, default: false }, // 是否禁用 readonly: { type: Boolean, default: false }, ...uni.$uv?.props?.calendars }, data(){ return { weeks: [], calendar: {}, nowDate: '', allowConfirm: false, multiple: false, range: false } }, computed:{ /** * for i18n */ confirmText() { return t("uv-calender.ok") }, cancelText() { return t("uv-calender.cancel") }, getConfirmColor() { if(this.range || this.multiple || this.readonly) { return this.allowConfirm? this.confirmColor: '#999' }else { return this.confirmColor; } } }, watch: { date(newVal) { this.init(newVal) }, startDate(val) { this.cale.resetSatrtDate(val) this.cale.setDate(this.nowDate.fullDate) this.weeks = this.cale.weeks }, endDate(val) { this.cale.resetEndDate(val) this.cale.setDate(this.nowDate.fullDate) this.weeks = this.cale.weeks }, selected(newVal) { this.cale.setSelectInfo(this.nowDate.fullDate, newVal) this.weeks = this.cale.weeks } }, created() { this.setMode(); this.cale = new Calendar({ selected: this.selected, startDate: this.startDate, endDate: this.endDate, range: this.range, multiple: this.multiple, allowSameDay: this.allowSameDay }) this.init(this.date) }, methods: { setMode() { switch (this.mode){ case 'range': this.range = true; break; case 'multiple': this.multiple = true; default: break; } }, async open() { if (this.clearDate && !this.insert) { this.cale.cleanRangeStatus() this.init(this.date) } if(!this.insert){ this.$refs.popup.open(); } }, close() { this.$refs.popup.close(); this.$emit('close'); }, confirm() { if(this.readonly) { return; } else if(this.range && !this.cale.rangeStatus.after) { return; } else if(this.multiple && this.cale.multipleStatus.data.length == 0){ return; } this.setEmit('confirm'); this.close() }, maskClick() { if(this.closeOnClickOverlay) { this.$emit('close'); } }, bindDateChange(e) { const value = e.detail.value + '-1' this.setDate(value) const { year, month } = this.cale.getDate(value) this.$emit('monthSwitch', { year, month }) }, /** * 初始化日期显示 * @param {Object} date */ init(date) { if(this.range) { // 重置范围选择状态 this.cale.cleanRangeStatus(); }else if(this.multiple){ // 重置多选状态 this.cale.cleanMultipleStatus(); } this.cale.setDate(date,'init') this.weeks = this.cale.weeks this.nowDate = this.calendar = this.cale.getInfo(date) this.changeConfirmStatus(); }, /** * 变化触发 */ change() { this.changeConfirmStatus(); if (!this.insert) return this.setEmit('change') }, changeConfirmStatus() { if(this.readonly) { this.allowConfirm = false; } else if (this.range) { this.allowConfirm = this.cale.rangeStatus.after ? true : false; } else if(this.multiple) { this.allowConfirm = this.cale.multipleStatus.data.length > 0 ? true : false; } }, /** * 选择月份触发 */ monthSwitch() { let { year, month } = this.nowDate this.$emit('monthSwitch', { year, month: Number(month) }) }, /** * 派发事件 * @param {Object} name */ setEmit(name) { let { year, month, date, fullDate, lunar, extraInfo } = this.calendar this.$emit(name, { range: this.cale.rangeStatus, multiple: this.cale.multipleStatus, year, month, date, fulldate: fullDate, lunar, extraInfo: extraInfo || {} }) }, /** * 选择天触发 * @param {Object} weeks */ choiceDate(weeks) { if (weeks.disable || this.readonly) return this.calendar = weeks // 设置范围选择 this.cale.setRange(this.calendar.fullDate) // 设置多选 this.cale.setMultiple(this.calendar.fullDate); this.weeks = this.cale.weeks this.change() }, /** * 回到今天 */ backToday() { const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}` const date = this.cale.getDate(new Date()) const todayYearMonth = `${date.year}-${date.month}` this.init(date.fullDate) if (nowYearMonth !== todayYearMonth) { this.monthSwitch() } this.change() }, /** * 上个月 */ pre() { const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate this.setDate(preDate) this.monthSwitch() }, /** * 下个月 */ next() { const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate this.setDate(nextDate) this.monthSwitch() }, /** * 设置日期 * @param {Object} date */ setDate(date) { this.cale.setDate(date) this.weeks = this.cale.weeks this.nowDate = this.cale.getInfo(date) } } } </script> <style scoped lang="scss"> $uv-border-color: #EDEDED !default; .uv-calendar__content { background-color: #fff; } .line { width: 750rpx; height: 1px; border-bottom-color: $uv-border-color; border-bottom-style: solid; border-bottom-width: 1px; } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-calendars/components/uv-calendars/uv-calendars.vue
Vue
unknown
11,215
export default { props: { // 标题 title: { type: [String, Number], default: '' }, // 标题下方的描述信息 label: { type: [String, Number], default: '' }, // 右侧的内容 value: { type: [String, Number], default: '' }, // 左侧图标名称,或者图片链接(本地文件建议使用绝对地址) icon: { type: String, default: '' }, // 是否禁用cell disabled: { type: Boolean, default: false }, // 是否显示下边框 border: { type: Boolean, default: true }, // 内容是否垂直居中(主要是针对右侧的value部分) center: { type: Boolean, default: true }, // 点击后跳转的URL地址 url: { type: String, default: '' }, // 链接跳转的方式,内部使用的是uvui封装的route方法,可能会进行拦截操作 linkType: { type: String, default: 'navigateTo' }, // 是否开启点击反馈(表现为点击时加上灰色背景) clickable: { type: Boolean, default: false }, // 是否展示右侧箭头并开启点击反馈 isLink: { type: Boolean, default: false }, // 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件) required: { type: Boolean, default: false }, // 右侧的图标箭头 rightIcon: { type: String, default: 'arrow-right' }, // 右侧箭头的方向,可选值为:left,up,down arrowDirection: { type: String, default: '' }, // 左侧图标样式 iconStyle: { type: [Object, String], default: () => { return {} } }, // 右侧箭头图标的样式 rightIconStyle: { type: [Object, String], default: () => { return {} } }, // 标题的样式 titleStyle: { type: [Object, String], default: () => { return {} } }, // 单位元的大小,可选值为large size: { type: String, default: '' }, // 点击cell是否阻止事件传播 stop: { type: Boolean, default: true }, // 标识符,cell被点击时返回 name: { type: [Number, String], default: '' }, // 单元格自定义样式 cellStyle: { type: [Object, String], default: () => {} }, ...uni.$uv?.props?.cell } }
2301_77169380/AppruanjianApk
uni_modules/uv-cell/components/uv-cell/props.js
JavaScript
unknown
2,241
<template> <view class="uv-cell" :class="[customClass]" :style="[$uv.addStyle(customStyle)]" :hover-class="(!disabled && (clickable || isLink)) ? 'uv-cell--clickable' : ''" :hover-stay-time="250" @click="clickHandler"> <view class="uv-cell__body" :class="[ center && 'uv-cell--center', size === 'large' && 'uv-cell__body--large']" :style="[cellStyle]" > <view class="uv-cell__body__content"> <view class="uv-cell__left-icon-wrap"> <slot name="icon"> <uv-icon v-if="icon" :name="icon" :custom-style="iconStyle" :size="size === 'large' ? 22 : 18"></uv-icon> </slot> </view> <view class="uv-cell__title"> <slot name="title"> <text v-if="title" class="uv-cell__title-text" :style="[titleTextStyle]" :class="[disabled && 'uv-cell--disabled', size === 'large' && 'uv-cell__title-text--large']">{{ title }}</text> </slot> <slot name="label"> <text class="uv-cell__label" v-if="label" :class="[disabled && 'uv-cell--disabled', size === 'large' && 'uv-cell__label--large']">{{ label }}</text> </slot> </view> </view> <slot name="value"> <text class="uv-cell__value" :class="[disabled && 'uv-cell--disabled', size === 'large' && 'uv-cell__value--large']" v-if="!$uv.test.empty(value)">{{ value }}</text> </slot> <view class="uv-cell__right-icon-wrap" :class="[`uv-cell__right-icon-wrap--${arrowDirection}`]"> <slot name="right-icon"> <uv-icon v-if="isLink" :name="rightIcon" :custom-style="rightIconStyle" :color="disabled ? '#c8c9cc' : 'info'" :size="size === 'large' ? 18 : 16"></uv-icon> </slot> </view> </view> <uv-line v-if="border"></uv-line> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * cell 单元格 * @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。 * @tutorial https://www.uvui.cn/components/cell.html * @property {String | Number} title 标题 * @property {String | Number} label 标题下方的描述信息 * @property {String | Number} value 右侧的内容 * @property {String} icon 左侧图标名称,或者图片链接(本地文件建议使用绝对地址) * @property {Boolean} disabled 是否禁用cell * @property {Boolean} border 是否显示下边框 (默认 true ) * @property {Boolean} center 内容是否垂直居中(主要是针对右侧的value部分) (默认 false ) * @property {String} url 点击后跳转的URL地址 * @property {String} linkType 链接跳转的方式,内部使用的是uvui封装的route方法,可能会进行拦截操作 (默认 'navigateTo' ) * @property {Boolean} clickable 是否开启点击反馈(表现为点击时加上灰色背景) (默认 false ) * @property {Boolean} isLink 是否展示右侧箭头并开启点击反馈 (默认 false ) * @property {Boolean} required 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件) (默认 false ) * @property {String} rightIcon 右侧的图标箭头 (默认 'arrow-right') * @property {String} arrowDirection 右侧箭头的方向,可选值为:left,up,down * @property {Object | String} rightIconStyle 右侧箭头图标的样式 * @property {Object | String} titleStyle 标题的样式 * @property {Object | String} iconStyle 左侧图标样式 * @property {String} size 单位元的大小,可选值为 large,normal,mini * @property {Boolean} stop 点击cell是否阻止事件传播 (默认 true ) * @property {Object | String} cellStyle 单元格自定义样式 * @property {Object} customStyle 定义需要用到的外部样式 * * @event {Function} click 点击cell列表时触发 * @example 该组件需要搭配cell-group组件使用,见官方文档示例 */ export default { name: 'uv-cell', emits: ['click'], mixins: [mpMixin, mixin, props], computed: { titleTextStyle() { return this.$uv.addStyle(this.titleStyle) } }, methods: { // 点击cell clickHandler(e) { if (this.disabled) return this.$emit('click', { name: this.name }) // 如果配置了url(此props参数通过mixin引入)参数,跳转页面 this.openPage() // 是否阻止事件传播 this.stop && this.preventEvent(e) }, } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; $uv-cell-padding: 10px 15px !default; $uv-cell-font-size: 15px !default; $uv-cell-line-height: 24px !default; $uv-cell-color: $uv-main-color !default; $uv-cell-icon-size: 16px !default; $uv-cell-title-font-size: 15px !default; $uv-cell-title-line-height: 22px !default; $uv-cell-title-color: $uv-main-color !default; $uv-cell-label-font-size: 12px !default; $uv-cell-label-color: $uv-tips-color !default; $uv-cell-label-line-height: 18px !default; $uv-cell-value-font-size: 14px !default; $uv-cell-value-color: $uv-content-color !default; $uv-cell-clickable-color: $uv-bg-color !default; $uv-cell-disabled-color: #c8c9cc !default; $uv-cell-padding-top-large: 13px !default; $uv-cell-padding-bottom-large: 13px !default; $uv-cell-value-font-size-large: 15px !default; $uv-cell-label-font-size-large: 14px !default; $uv-cell-title-font-size-large: 16px !default; $uv-cell-left-icon-wrap-margin-right: 4px !default; $uv-cell-right-icon-wrap-margin-left: 4px !default; $uv-cell-title-flex: 1 !default; $uv-cell-label-margin-top: 5px !default; .uv-cell { &__body { @include flex(); /* #ifndef APP-NVUE */ box-sizing: border-box; /* #endif */ padding: $uv-cell-padding; font-size: $uv-cell-font-size; color: $uv-cell-color; &__content { @include flex(row); align-items: center; flex: 1; } &--large { padding-top: $uv-cell-padding-top-large; padding-bottom: $uv-cell-padding-bottom-large; } } &__left-icon-wrap, &__right-icon-wrap { @include flex(); align-items: center; // height: $uv-cell-line-height; font-size: $uv-cell-icon-size; } &__left-icon-wrap { margin-right: $uv-cell-left-icon-wrap-margin-right; } &__right-icon-wrap { margin-left: $uv-cell-right-icon-wrap-margin-left; transition: transform 0.3s; &--up { transform: rotate(-90deg); } &--down { transform: rotate(90deg); } } &__title { flex: $uv-cell-title-flex; &-text { font-size: $uv-cell-title-font-size; line-height: $uv-cell-title-line-height; color: $uv-cell-title-color; &--large { font-size: $uv-cell-title-font-size-large; } } } &__label { margin-top: $uv-cell-label-margin-top; font-size: $uv-cell-label-font-size; color: $uv-cell-label-color; line-height: $uv-cell-label-line-height; &--large { font-size: $uv-cell-label-font-size-large; } } &__value { text-align: right; font-size: $uv-cell-value-font-size; line-height: $uv-cell-line-height; color: $uv-cell-value-color; &--large { font-size: $uv-cell-value-font-size-large; } } &--clickable { background-color: $uv-cell-clickable-color; } &--disabled { color: $uv-cell-disabled-color; /* #ifndef APP-NVUE */ cursor: not-allowed; /* #endif */ } &--center { align-items: center; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-cell/components/uv-cell/uv-cell.vue
Vue
unknown
7,550
export default { props: { // 分组标题 title: { type: String, default: '' }, // 是否显示外边框 border: { type: Boolean, default: true }, ...uni.$uv?.props?.cellGroup } }
2301_77169380/AppruanjianApk
uni_modules/uv-cell/components/uv-cell-group/props.js
JavaScript
unknown
207
<template> <view :style="[$uv.addStyle(customStyle)]" :class="[customClass]" class="uv-cell-group"> <view v-if="title" class="uv-cell-group__title"> <slot name="title"> <text class="uv-cell-group__title__text">{{ title }}</text> </slot> </view> <view class="uv-cell-group__wrapper"> <uv-line v-if="border"></uv-line> <slot /> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * cellGroup 单元格 * @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。 * @tutorial https://www.uvui.cn/components/cell.html * * @property {String} title 分组标题 * @property {Boolean} border 是否显示外边框 (默认 true ) * @property {Object} customStyle 定义需要用到的外部样式 * * @event {Function} click 点击cell列表时触发 * @example <uv-cell-group title="设置喜好"> */ export default { name: 'uv-cell-group', mixins: [mpMixin, mixin, props] } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; $uv-cell-group-title-padding: 16px 16px 8px !default; $uv-cell-group-title-font-size: 15px !default; $uv-cell-group-title-line-height: 16px !default; $uv-cell-group-title-color: $uv-main-color !default; .uv-cell-group { flex: 1; &__title { padding: $uv-cell-group-title-padding; &__text { font-size: $uv-cell-group-title-font-size; line-height: $uv-cell-group-title-line-height; color: $uv-cell-group-title-color; } } &__wrapper { position: relative; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.vue
Vue
unknown
1,934
export default { props: { // checkbox的名称 name: { type: [String, Number, Boolean], default: '' }, // 形状,square为方形,circle为圆型 shape: { type: String, default: '' }, // 整体的大小 size: { type: [String, Number], default: '' }, // 是否默认选中 checked: { type: Boolean, default: false }, // 是否禁用 disabled: { type: [String, Boolean], default: '' }, // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 activeColor: { type: String, default: '' }, // 未选中的颜色 inactiveColor: { type: String, default: '' }, // 图标的大小,单位px iconSize: { type: [String, Number], default: '' }, // 图标颜色 iconColor: { type: String, default: '' }, // label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式 label: { type: [String, Number, Boolean], default: '' }, // label的字体大小,px单位 labelSize: { type: [String, Number], default: '' }, // label的颜色 labelColor: { type: String, default: '' }, // 是否禁止点击提示语选中复选框 labelDisabled: { type: [String, Boolean], default: '' }, ...uni.$uv?.props?.checkbox } }
2301_77169380/AppruanjianApk
uni_modules/uv-checkbox/components/uv-checkbox/props.js
JavaScript
unknown
1,331
<template> <view class="uv-checkbox" :style="[checkboxStyle]" @tap.stop="wrapperClickHandler" :class="[`uv-checkbox-label--${parentData.iconPlacement}`, parentData.borderBottom && parentData.placement === 'column' && 'uv-border-bottom']" > <view class="uv-checkbox__icon-wrap" @tap.stop="iconClickHandler" :class="iconClasses" :style="[iconWrapStyle]" > <slot name="icon"> <uv-icon class="uv-checkbox__icon-wrap__icon" name="checkbox-mark" :size="elIconSize" :color="elIconColor" /> </slot> </view> <view class="uv-checkbox__label-wrap" @tap.stop="labelClickHandler"> <slot> <text :style="{ color: elDisabled ? elInactiveColor : elLabelColor, fontSize: elLabelSize, lineHeight: elLabelSize }" >{{label}}</text> </slot> </view> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * checkbox 复选框 * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便 * @tutorial https://www.uvui.cn/components/checkbox.html * @property {String | Number | Boolean} name checkbox组件的标示符 * @property {String} shape 形状,square为方形,circle为圆型 * @property {String | Number} size 整体的大小 * @property {Boolean} checked 是否默认选中 * @property {String | Boolean} disabled 是否禁用 * @property {String} activeColor 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 * @property {String} inactiveColor 未选中的颜色 * @property {String | Number} iconSize 图标的大小,单位px * @property {String} iconColor 图标颜色 * @property {String | Number} label label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式 * @property {String} labelColor label的颜色 * @property {String | Number} labelSize label的字体大小,px单位 * @property {String | Boolean} labelDisabled 是否禁止点击提示语选中复选框 * @property {Object} customStyle 定义需要用到的外部样式 * * @event {Function} change 任一个checkbox状态发生变化时触发,回调为一个对象 * @example <uv-checkbox v-model="checked" :disabled="false">天涯</uv-checkbox> */ export default { name: "uv-checkbox", mixins: [mpMixin, mixin, props], data() { return { isChecked: false, // 父组件的默认值,因为头条小程序不支持在computed中使用this.parent.shape的形式 // 故只能使用如此方法 parentData: { iconSize: 12, labelDisabled: null, disabled: null, shape: 'square', activeColor: null, inactiveColor: null, size: 18, value: null, modelValue: null, iconColor: null, placement: 'row', borderBottom: false, iconPlacement: 'left', labelSize: 14, labelColor: '#303133' } } }, computed: { // 是否禁用,如果父组件uv-raios-group禁用的话,将会忽略子组件的配置 elDisabled() { return this.disabled !== '' ? this.disabled : this.parentData.disabled !== null ? this.parentData.disabled : false; }, // 是否禁用label点击 elLabelDisabled() { return this.labelDisabled !== '' ? this.labelDisabled : this.parentData.labelDisabled !== null ? this.parentData.labelDisabled : false; }, // 组件尺寸,对应size的值,默认值为21px elSize() { return this.size ? this.size : (this.parentData.size ? this.parentData.size : 21); }, // 组件的勾选图标的尺寸,默认12px elIconSize() { return this.iconSize ? this.iconSize : (this.parentData.iconSize ? this.parentData.iconSize : 12); }, // 组件选中激活时的颜色 elActiveColor() { return this.activeColor ? this.activeColor : (this.parentData.activeColor ? this.parentData.activeColor : '#2979ff'); }, // 组件选未中激活时的颜色 elInactiveColor() { return this.inactiveColor ? this.inactiveColor : (this.parentData.inactiveColor ? this.parentData.inactiveColor : '#c8c9cc'); }, // label的颜色 elLabelColor() { return this.labelColor ? this.labelColor : (this.parentData.labelColor ? this.parentData.labelColor : '#606266') }, // 组件的形状 elShape() { return this.shape ? this.shape : (this.parentData.shape ? this.parentData.shape : 'circle'); }, // label大小 elLabelSize() { return this.$uv.addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize : '15')) }, elIconColor() { const iconColor = this.iconColor ? this.iconColor : (this.parentData.iconColor ? this.parentData.iconColor : '#ffffff'); // 图标的颜色 if (this.elDisabled) { // disabled状态下,已勾选的checkbox图标改为elInactiveColor return this.isChecked ? this.elInactiveColor : 'transparent' } else { return this.isChecked ? iconColor : 'transparent' } }, iconClasses() { let classes = [] // 组件的形状 classes.push('uv-checkbox__icon-wrap--' + this.elShape) if (this.elDisabled) { classes.push('uv-checkbox__icon-wrap--disabled') } if (this.isChecked && this.elDisabled) { classes.push('uv-checkbox__icon-wrap--disabled--checked') } // 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效 // #ifdef MP-ALIPAY || MP-TOUTIAO classes = classes.join(' ') // #endif return classes }, iconWrapStyle() { // checkbox的整体样式 const style = {} style.backgroundColor = this.isChecked && !this.elDisabled ? this.elActiveColor : '#ffffff' style.borderColor = this.isChecked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor style.width = this.$uv.addUnit(this.elSize) style.height = this.$uv.addUnit(this.elSize) // 如果是图标在右边的话,移除它的右边距 if (this.parentData.iconPlacement === 'right') { style.marginRight = 0 } return style }, checkboxStyle() { const style = {} if (this.parentData.borderBottom && this.parentData.placement === 'row') { this.$uv.error('检测到您将borderBottom设置为true,需要同时将uv-checkbox-group的placement设置为column才有效') } // 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔 if (this.parentData.borderBottom && this.parentData.placement === 'column') { style.paddingBottom = '8px' } return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle)) } }, created() { this.init() }, methods: { init() { // 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用 this.updateParentData() if (!this.parent) { this.$uv.error('uv-checkbox必须搭配uv-checkbox-group组件使用') } this.$nextTick(()=>{ let parentValue = []; if(this.parentData.value.length) { parentValue = this.parentData.value; } else if (this.parentData.modelValue.length){ parentValue = this.parentData.modelValue; } // 设置初始化时,是否默认选中的状态,父组件uv-checkbox-group的value可能是array,所以额外判断 if (this.checked) { this.isChecked = true } else if (this.$uv.test.array(parentValue)) { // 查找数组是是否存在this.name元素值 this.isChecked = parentValue.some(item => { return item === this.name }) } }) }, updateParentData() { this.getParentData('uv-checkbox-group') }, // 横向两端排列时,点击组件即可触发选中事件 wrapperClickHandler(e) { this.parentData.iconPlacement === 'right' && this.iconClickHandler(e) }, // 点击图标 iconClickHandler(e) { this.preventEvent(e) // 如果整体被禁用,不允许被点击 if (!this.elDisabled) { this.setRadioCheckedStatus() } }, // 点击label labelClickHandler(e) { this.preventEvent(e) // 如果按钮整体被禁用或者label被禁用,则不允许点击文字修改状态 if (!this.elLabelDisabled && !this.elDisabled) { this.setRadioCheckedStatus() } }, emitEvent() { this.$emit('change', this.isChecked) // 尝试调用uv-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时 this.$nextTick(() => { this.$uv.formValidate(this, 'change') }) }, // 改变组件选中状态 // 这里的改变的依据是,更改本组件的checked值为true,同时通过父组件遍历所有uv-checkbox实例 // 将本组件外的其他uv-checkbox的checked都设置为false(都被取消选中状态),因而只剩下一个为选中状态 setRadioCheckedStatus() { // 将本组件标记为与原来相反的状态 this.isChecked = !this.isChecked this.emitEvent() typeof this.parent.unCheckedOther === 'function' && this.parent.unCheckedOther(this) } }, watch:{ checked(){ this.isChecked = this.checked } } } </script> <style lang="scss" scoped> $show-border: 1; $show-border-bottom: 1; @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; $uv-checkbox-label-wrap-padding-right:6px !default; $uv-checkbox-icon-wrap-font-size:6px !default; $uv-checkbox-icon-wrap-border-width:1px !default; $uv-checkbox-icon-wrap-border-color:#c8c9cc !default; $uv-checkbox-icon-wrap-icon-line-height:0 !default; $uv-checkbox-icon-wrap-circle-border-radius:100% !default; $uv-checkbox-icon-wrap-square-border-radius:3px !default; $uv-checkbox-icon-wrap-checked-color:#fff !default; $uv-checkbox-icon-wrap-checked-background-color:red !default; $uv-checkbox-icon-wrap-checked-border-color:#2979ff !default; $uv-checkbox-icon-wrap-disabled-background-color:#ebedf0 !default; $uv-checkbox-icon-wrap-disabled-checked-color:#c8c9cc !default; $uv-checkbox-label-margin-left:5px !default; $uv-checkbox-label-margin-right:12px !default; $uv-checkbox-label-color:$uv-content-color !default; $uv-checkbox-label-font-size:15px !default; $uv-checkbox-label-disabled-color:#c8c9cc !default; .uv-checkbox { /* #ifndef APP-NVUE */ @include flex(row); /* #endif */ overflow: hidden; flex-direction: row; align-items: center; &-label--left { flex-direction: row } &-label--right { flex-direction: row-reverse; justify-content: space-between } &__icon-wrap { /* #ifndef APP-NVUE */ box-sizing: border-box; // nvue下,border-color过渡有问题 transition-property: border-color, background-color, color; transition-duration: 0.2s; /* #endif */ color: $uv-content-color; @include flex; align-items: center; justify-content: center; color: transparent; text-align: center; font-size: $uv-checkbox-icon-wrap-font-size; border-width: $uv-checkbox-icon-wrap-border-width; border-color: $uv-checkbox-icon-wrap-border-color; border-style: solid; /* #ifdef MP-TOUTIAO */ // 头条小程序兼容性问题,需要设置行高为0,否则图标偏下 &__icon { line-height: $uv-checkbox-icon-wrap-icon-line-height; } /* #endif */ &--circle { border-radius: $uv-checkbox-icon-wrap-circle-border-radius; } &--square { border-radius: $uv-checkbox-icon-wrap-square-border-radius; } &--checked { color: $uv-checkbox-icon-wrap-checked-color; background-color: $uv-checkbox-icon-wrap-checked-background-color; border-color: $uv-checkbox-icon-wrap-checked-border-color; } &--disabled { background-color: $uv-checkbox-icon-wrap-disabled-background-color !important; } &--disabled--checked { color: $uv-checkbox-icon-wrap-disabled-checked-color !important; } } &__label { /* #ifndef APP-NVUE */ word-wrap: break-word; /* #endif */ margin-left: $uv-checkbox-label-margin-left; margin-right: $uv-checkbox-label-margin-right; color: $uv-checkbox-label-color; font-size: $uv-checkbox-label-font-size; &--disabled { color: $uv-checkbox-label-disabled-color; } } &__label-wrap { flex: 1; padding-left: $uv-checkbox-label-wrap-padding-right; } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-checkbox/components/uv-checkbox/uv-checkbox.vue
Vue
unknown
12,742
export default { props: { // 绑定的值 value: { type: Array, default: () => [] }, modelValue: { type: Array, default: () => [] }, // 标识符 name: { type: String, default: '' }, // 形状,circle-圆形,square-方形 shape: { type: String, default: 'square' }, // 是否禁用全部checkbox disabled: { type: Boolean, default: false }, // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 activeColor: { type: String, default: '#2979ff' }, // 未选中的颜色 inactiveColor: { type: String, default: '#c8c9cc' }, // 整个组件的尺寸,默认px size: { type: [String, Number], default: 18 }, // 布局方式,row-横向,column-纵向 placement: { type: String, default: 'row' }, // label的字体大小,px单位 labelSize: { type: [String, Number], default: 14 }, // label的字体颜色 labelColor: { type: [String], default: '#303133' }, // 是否禁止点击文本操作 labelDisabled: { type: Boolean, default: false }, // 图标颜色 iconColor: { type: String, default: '#fff' }, // 图标的大小,单位px iconSize: { type: [String, Number], default: 12 }, // 勾选图标的对齐方式,left-左边,right-右边 iconPlacement: { type: String, default: 'left' }, // 竖向配列时,是否显示下划线 borderBottom: { type: Boolean, default: false }, ...uni.$uv?.props?.checkboxGroup } }
2301_77169380/AppruanjianApk
uni_modules/uv-checkbox/components/uv-checkbox-group/props.js
JavaScript
unknown
1,549
<template> <view class="uv-checkbox-group" :class="bemClass" :style="[$uv.addStyle(this.customStyle)]" > <slot></slot> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * checkboxGroup 复选框组 * @description 复选框组件一般用于需要多个选择的场景,该组件功能完整,使用方便 * @tutorial https://www.uvui.cn/components/checkbox.html * @property {String} name 标识符 * @property {Array} value 绑定的值 * @property {String} shape 形状,circle-圆形,square-方形 (默认 'square' ) * @property {Boolean} disabled 是否禁用全部checkbox (默认 false ) * @property {String} activeColor 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 (默认 '#2979ff' ) * @property {String} inactiveColor 未选中的颜色 (默认 '#c8c9cc' ) * @property {String | Number} size 整个组件的尺寸 单位px (默认 18 ) * @property {String} placement 布局方式,row-横向,column-纵向 (默认 'row' ) * @property {String | Number} labelSize label的字体大小,px单位 (默认 14 ) * @property {String} labelColor label的字体颜色 (默认 '#303133' ) * @property {Boolean} labelDisabled 是否禁止点击文本操作 (默认 false ) * @property {String} iconColor 图标颜色 (默认 '#ffffff' ) * @property {String | Number} iconSize 图标的大小,单位px (默认 12 ) * @property {String} iconPlacement 勾选图标的对齐方式,left-左边,right-右边 (默认 'left' ) * @property {Boolean} borderBottom placement为row时,是否显示下边框 (默认 false ) * @event {Function} change 任一个checkbox状态发生变化时触发,回调为一个对象 * @event {Function} input 修改通过v-model绑定的值时触发,回调为一个对象 * @example <uv-checkbox-group></uv-checkbox-group> */ export default { name: 'uv-checkbox-group', mixins: [mpMixin, mixin, props], computed: { // 这里computed的变量,都是子组件uv-checkbox需要用到的,由于头条小程序的兼容性差异,子组件无法实时监听父组件参数的变化 // 所以需要手动通知子组件,这里返回一个parentData变量,供watch监听,在其中去通知每一个子组件重新从父组件(uv-checkbox-group) // 拉取父组件新的变化后的参数 parentData() { let value = []; if(this.value.length) { value = this.value; } else if (this.modelValue.length){ value = this.modelValue; } return [value, this.disabled, this.inactiveColor, this.activeColor, this.size, this.labelDisabled, this.shape, this.iconSize, this.borderBottom, this.placement, this.labelSize, this.labelColor] }, bemClass() { // this.bem为一个computed变量,在mixin中 return this.bem('checkbox-group', ['placement']) }, }, watch: { // 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件 parentData() { if (this.children.length) { this.children.map(child => { // 判断子组件(uv-checkbox)如果有init方法的话,就就执行(执行的结果是子组件重新从父组件拉取了最新的值) typeof(child.init) === 'function' && child.init() }) } }, }, data() { return { } }, created() { this.children = [] }, methods: { // 将其他的checkbox设置为未选中的状态 unCheckedOther(childInstance) { const values = [] this.children.map(child => { // 将被选中的checkbox,放到数组中返回 if (child.isChecked) { values.push(child.name) } }) // 修改通过v-model绑定的值 // #ifdef VUE2 this.$emit('input', values) // #endif // #ifdef VUE3 this.$emit('update:modelValue',values) // #endif // 发出事件 this.$emit('change', values) } } } </script> <style lang="scss" scoped> @import '@/uni_modules/uv-ui-tools/libs/css/components.scss'; @import '@/uni_modules/uv-ui-tools/libs/css/color.scss'; .uv-checkbox-group { flex: 1; &--row { @include flex; flex-wrap: wrap; } &--column { @include flex(column); } } </style>
2301_77169380/AppruanjianApk
uni_modules/uv-checkbox/components/uv-checkbox-group/uv-checkbox-group.vue
Vue
unknown
4,429
export default { props: { // 倒计时总秒数 seconds: { type: [String, Number], default: 60 }, // 尚未开始时提示 startText: { type: String, default: '获取验证码' }, // 正在倒计时中的提示 changeText: { type: String, default: 'X秒重新获取' }, // 倒计时结束时的提示 endText: { type: String, default: '重新获取' }, // 是否在H5刷新或各端返回再进入时继续倒计时 keepRunning: { type: Boolean, default: false }, // 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了 uniqueKey: { type: String, default: '' }, ...uni.$uv?.props?.code } }
2301_77169380/AppruanjianApk
uni_modules/uv-code/components/uv-code/props.js
JavaScript
unknown
715
<template> <view class="uv-code"> <!-- 此组件功能由js完成,无需写html逻辑 --> </view> </template> <script> import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js' import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js' import props from './props.js'; /** * Code 验证码倒计时 * @description 考虑到用户实际发送验证码的场景,可能是一个按钮,也可能是一段文字,提示语各有不同,所以本组件不提供界面显示,只提供倒计时文本,由用户将文本嵌入到具体的场景 * @tutorial https://www.uvui.cn/components/code.html * @property {String | Number} seconds 倒计时所需的秒数(默认 60 ) * @property {String} startText 开始前的提示语,见官网说明(默认 '获取验证码' ) * @property {String} changeText 倒计时期间的提示语,必须带有字母"x",见官网说明(默认 'X秒重新获取' ) * @property {String} endText 倒计结束的提示语,见官网说明(默认 '重新获取' ) * @property {Boolean} keepRunning 是否在H5刷新或各端返回再进入时继续倒计时( 默认false ) * @property {String} uniqueKey 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了 * * @event {Function} change 倒计时期间,每秒触发一次 * @event {Function} start 开始倒计时触发 * @event {Function} end 结束倒计时触发 * @example <uv-code ref="uCode" @change="codeChange" seconds="20"></uv-code> */ export default { name: "uv-code", mixins: [mpMixin, mixin, props], data() { return { secNum: this.seconds, timer: null, canGetCode: true, // 是否可以执行验证码操作 } }, mounted() { this.checkKeepRunning() }, watch: { seconds: { immediate: true, handler(n) { this.secNum = n } } }, methods: { checkKeepRunning() { // 获取上一次退出页面(H5还包括刷新)时的时间戳,如果没有上次的保存,此值可能为空 let lastTimestamp = Number(uni.getStorageSync(this.uniqueKey + '_$uCountDownTimestamp')) if (!lastTimestamp) return this.changeEvent(this.startText) // 当前秒的时间戳 let nowTimestamp = Math.floor((+new Date()) / 1000) // 判断当前的时间戳,是否小于上一次的本该按设定结束,却提前结束的时间戳 if (this.keepRunning && lastTimestamp && lastTimestamp > nowTimestamp) { // 剩余尚未执行完的倒计秒数 this.secNum = lastTimestamp - nowTimestamp // 清除本地保存的变量 uni.removeStorageSync(this.uniqueKey + '_$uCountDownTimestamp') // 开始倒计时 this.start() } else { // 如果不存在需要继续上一次的倒计时,执行正常的逻辑 this.changeEvent(this.startText) } }, // 开始倒计时 start() { // 防止快速点击获取验证码的按钮而导致内部产生多个定时器导致混乱 if (this.timer) { clearInterval(this.timer) this.timer = null } this.$emit('start') this.canGetCode = false // 这里放这句,是为了一开始时就提示,否则要等setInterval的1秒后才会有提示 this.changeEvent(this.changeText.replace(/x|X/, this.secNum)) this.timer = setInterval(() => { if (--this.secNum) { // 用当前倒计时的秒数替换提示字符串中的"x"字母 this.changeEvent(this.changeText.replace(/x|X/, this.secNum)) } else { clearInterval(this.timer) this.timer = null this.changeEvent(this.endText) this.secNum = this.seconds this.$emit('end') this.canGetCode = true } }, 1000) this.setTimeToStorage() }, // 重置,可以让用户再次获取验证码 reset() { this.canGetCode = true clearInterval(this.timer) this.secNum = this.seconds this.changeEvent(this.endText) }, changeEvent(text) { this.$emit('change', text) }, // 保存时间戳,为了防止倒计时尚未结束,H5刷新或者各端的右上角返回上一页再进来 setTimeToStorage() { if (!this.keepRunning || !this.timer) return // 记录当前的时间戳,为了下次进入页面,如果还在倒计时内的话,继续倒计时 // 倒计时尚未结束,结果大于0;倒计时已经开始,就会小于初始值,如果等于初始值,说明没有开始倒计时,无需处理 if (this.secNum > 0 && this.secNum <= this.seconds) { // 获取当前时间戳(+ new Date()为特殊写法),除以1000变成秒,再去除小数部分 let nowTimestamp = Math.floor((+new Date()) / 1000) // 将本该结束时候的时间戳保存起来 => 当前时间戳 + 剩余的秒数 uni.setStorage({ key: this.uniqueKey + '_$uCountDownTimestamp', data: nowTimestamp + Number(this.secNum) }) } } }, // #ifdef VUE2 // 组件销毁的时候,清除定时器,否则定时器会继续存在,系统不会自动清除 beforeDestroy() { this.setTimeToStorage() clearTimeout(this.timer) this.timer = null }, // #endif // #ifdef VUE3 // 组件销毁,兼容vue3 unmounted() { this.setTimeToStorage() clearTimeout(this.timer) this.timer = null } // #endif } </script>
2301_77169380/AppruanjianApk
uni_modules/uv-code/components/uv-code/uv-code.vue
Vue
unknown
5,368