oxy-uni-ui 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/attributes.json +1 -0
- package/components/common/AbortablePromise.ts +28 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +89 -0
- package/components/common/abstracts/_mixin.scss +385 -0
- package/components/common/abstracts/variable.scss +974 -0
- package/components/common/base64.ts +29 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +25 -0
- package/components/common/event.ts +8 -0
- package/components/common/interceptor.ts +43 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +778 -0
- package/components/composables/index.ts +11 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +113 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +37 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +176 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +43 -0
- package/components/composables/useTranslate.ts +12 -0
- package/components/composables/useUpload.ts +364 -0
- package/components/oxy-action-sheet/index.scss +204 -0
- package/components/oxy-action-sheet/oxy-action-sheet.vue +155 -0
- package/components/oxy-action-sheet/types.ts +118 -0
- package/components/oxy-backtop/index.scss +25 -0
- package/components/oxy-backtop/oxy-backtop.vue +45 -0
- package/components/oxy-backtop/types.ts +37 -0
- package/components/oxy-badge/index.scss +63 -0
- package/components/oxy-badge/oxy-badge.vue +61 -0
- package/components/oxy-badge/types.ts +41 -0
- package/components/oxy-button/index.scss +336 -0
- package/components/oxy-button/oxy-button.vue +195 -0
- package/components/oxy-button/types.ts +133 -0
- package/components/oxy-calendar/index.scss +158 -0
- package/components/oxy-calendar/oxy-calendar.vue +451 -0
- package/components/oxy-calendar/types.ts +217 -0
- package/components/oxy-calendar-view/index.scss +0 -0
- package/components/oxy-calendar-view/month/index.scss +162 -0
- package/components/oxy-calendar-view/month/month.vue +389 -0
- package/components/oxy-calendar-view/month/types.ts +20 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +89 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +374 -0
- package/components/oxy-calendar-view/monthPanel/types.ts +48 -0
- package/components/oxy-calendar-view/oxy-calendar-view.vue +111 -0
- package/components/oxy-calendar-view/types.ts +109 -0
- package/components/oxy-calendar-view/utils.ts +429 -0
- package/components/oxy-calendar-view/year/index.scss +153 -0
- package/components/oxy-calendar-view/year/types.ts +20 -0
- package/components/oxy-calendar-view/year/year.vue +202 -0
- package/components/oxy-calendar-view/yearPanel/index.scss +24 -0
- package/components/oxy-calendar-view/yearPanel/types.ts +38 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +135 -0
- package/components/oxy-card/index.scss +71 -0
- package/components/oxy-card/oxy-card.vue +37 -0
- package/components/oxy-card/types.ts +30 -0
- package/components/oxy-cell/index.scss +206 -0
- package/components/oxy-cell/oxy-cell.vue +140 -0
- package/components/oxy-cell/types.ts +111 -0
- package/components/oxy-cell-group/index.scss +56 -0
- package/components/oxy-cell-group/oxy-cell-group.vue +45 -0
- package/components/oxy-cell-group/types.ts +32 -0
- package/components/oxy-checkbox/index.scss +285 -0
- package/components/oxy-checkbox/oxy-checkbox.vue +177 -0
- package/components/oxy-checkbox/types.ts +68 -0
- package/components/oxy-checkbox-group/index.scss +20 -0
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +100 -0
- package/components/oxy-checkbox-group/types.ts +59 -0
- package/components/oxy-circle/index.scss +18 -0
- package/components/oxy-circle/oxy-circle.vue +296 -0
- package/components/oxy-circle/types.ts +54 -0
- package/components/oxy-col/index.scss +19 -0
- package/components/oxy-col/oxy-col.vue +49 -0
- package/components/oxy-col/types.ts +15 -0
- package/components/oxy-col-picker/index.scss +168 -0
- package/components/oxy-col-picker/oxy-col-picker.vue +498 -0
- package/components/oxy-col-picker/types.ts +166 -0
- package/components/oxy-collapse/index.scss +55 -0
- package/components/oxy-collapse/oxy-collapse.vue +151 -0
- package/components/oxy-collapse/types.ts +58 -0
- package/components/oxy-collapse-item/index.scss +90 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +171 -0
- package/components/oxy-collapse-item/types.ts +48 -0
- package/components/oxy-config-provider/oxy-config-provider.vue +73 -0
- package/components/oxy-config-provider/types.ts +1052 -0
- package/components/oxy-count-down/index.scss +15 -0
- package/components/oxy-count-down/oxy-count-down.vue +60 -0
- package/components/oxy-count-down/types.ts +41 -0
- package/components/oxy-count-down/utils.ts +52 -0
- package/components/oxy-count-to/index.scss +7 -0
- package/components/oxy-count-to/oxy-count-to.vue +125 -0
- package/components/oxy-count-to/types.ts +117 -0
- package/components/oxy-curtain/index.scss +85 -0
- package/components/oxy-curtain/oxy-curtain.vue +172 -0
- package/components/oxy-curtain/types.ts +73 -0
- package/components/oxy-datetime-picker/index.scss +164 -0
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +801 -0
- package/components/oxy-datetime-picker/types.ts +231 -0
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +499 -0
- package/components/oxy-datetime-picker-view/types.ts +120 -0
- package/components/oxy-datetime-picker-view/util.ts +30 -0
- package/components/oxy-design-uni/oxy-design-uni.vue +5 -0
- package/components/oxy-divider/index.scss +100 -0
- package/components/oxy-divider/oxy-divider.vue +52 -0
- package/components/oxy-divider/types.ts +35 -0
- package/components/oxy-drop-menu/index.scss +86 -0
- package/components/oxy-drop-menu/oxy-drop-menu.vue +166 -0
- package/components/oxy-drop-menu/types.ts +38 -0
- package/components/oxy-drop-menu-item/index.scss +66 -0
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +221 -0
- package/components/oxy-drop-menu-item/types.ts +94 -0
- package/components/oxy-fab/index.scss +116 -0
- package/components/oxy-fab/oxy-fab.vue +276 -0
- package/components/oxy-fab/types.ts +66 -0
- package/components/oxy-floating-panel/index.scss +64 -0
- package/components/oxy-floating-panel/oxy-floating-panel.vue +140 -0
- package/components/oxy-floating-panel/type.ts +32 -0
- package/components/oxy-form/oxy-form.vue +207 -0
- package/components/oxy-form/types.ts +76 -0
- package/components/oxy-form-item/index.scss +18 -0
- package/components/oxy-form-item/oxy-form-item.vue +56 -0
- package/components/oxy-form-item/types.ts +16 -0
- package/components/oxy-gap/index.scss +9 -0
- package/components/oxy-gap/oxy-gap.vue +36 -0
- package/components/oxy-gap/types.ts +17 -0
- package/components/oxy-grid/index.scss +9 -0
- package/components/oxy-grid/oxy-grid.vue +106 -0
- package/components/oxy-grid/types.ts +50 -0
- package/components/oxy-grid-item/index.scss +148 -0
- package/components/oxy-grid-item/oxy-grid-item.vue +176 -0
- package/components/oxy-grid-item/types.ts +77 -0
- package/components/oxy-icon/index.scss +1230 -0
- package/components/oxy-icon/oxy-icon.vue +53 -0
- package/components/oxy-icon/oxy-icons.ttf +0 -0
- package/components/oxy-icon/types.ts +21 -0
- package/components/oxy-img/index.scss +19 -0
- package/components/oxy-img/oxy-img.vue +81 -0
- package/components/oxy-img/types.ts +61 -0
- package/components/oxy-img-cropper/index.scss +231 -0
- package/components/oxy-img-cropper/oxy-img-cropper.vue +664 -0
- package/components/oxy-img-cropper/types.ts +76 -0
- package/components/oxy-index-anchor/index.scss +35 -0
- package/components/oxy-index-anchor/oxy-index-anchor.vue +55 -0
- package/components/oxy-index-anchor/type.ts +9 -0
- package/components/oxy-index-bar/index.scss +39 -0
- package/components/oxy-index-bar/oxy-index-bar.vue +156 -0
- package/components/oxy-index-bar/type.ts +23 -0
- package/components/oxy-input/index.scss +323 -0
- package/components/oxy-input/oxy-input.vue +300 -0
- package/components/oxy-input/placeholder.scss +21 -0
- package/components/oxy-input/types.ts +189 -0
- package/components/oxy-input-number/index.scss +132 -0
- package/components/oxy-input-number/oxy-input-number.vue +464 -0
- package/components/oxy-input-number/types.ts +101 -0
- package/components/oxy-keyboard/constants.ts +81 -0
- package/components/oxy-keyboard/index.scss +102 -0
- package/components/oxy-keyboard/key/index.scss +79 -0
- package/components/oxy-keyboard/key/index.vue +76 -0
- package/components/oxy-keyboard/key/types.ts +11 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +206 -0
- package/components/oxy-keyboard/types.ts +92 -0
- package/components/oxy-loading/index.scss +37 -0
- package/components/oxy-loading/oxy-loading.vue +90 -0
- package/components/oxy-loading/types.ts +22 -0
- package/components/oxy-loadmore/index.scss +39 -0
- package/components/oxy-loadmore/oxy-loadmore.vue +59 -0
- package/components/oxy-loadmore/types.ts +30 -0
- package/components/oxy-message-box/index.scss +108 -0
- package/components/oxy-message-box/index.ts +87 -0
- package/components/oxy-message-box/oxy-message-box.vue +291 -0
- package/components/oxy-message-box/types.ts +132 -0
- package/components/oxy-navbar/index.scss +93 -0
- package/components/oxy-navbar/oxy-navbar.vue +111 -0
- package/components/oxy-navbar/types.ts +52 -0
- package/components/oxy-navbar-capsule/index.scss +66 -0
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +35 -0
- package/components/oxy-navbar-capsule/types.ts +8 -0
- package/components/oxy-notice-bar/index.scss +68 -0
- package/components/oxy-notice-bar/oxy-notice-bar.vue +266 -0
- package/components/oxy-notice-bar/types.ts +67 -0
- package/components/oxy-notify/index.scss +34 -0
- package/components/oxy-notify/index.ts +61 -0
- package/components/oxy-notify/oxy-notify.vue +85 -0
- package/components/oxy-notify/types.ts +66 -0
- package/components/oxy-number-keyboard/index.scss +78 -0
- package/components/oxy-number-keyboard/key/index.scss +81 -0
- package/components/oxy-number-keyboard/key/index.vue +78 -0
- package/components/oxy-number-keyboard/key/types.ts +11 -0
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +151 -0
- package/components/oxy-number-keyboard/types.ts +83 -0
- package/components/oxy-overlay/index.scss +17 -0
- package/components/oxy-overlay/oxy-overlay.vue +47 -0
- package/components/oxy-overlay/types.ts +25 -0
- package/components/oxy-pagination/index.scss +57 -0
- package/components/oxy-pagination/oxy-pagination.vue +110 -0
- package/components/oxy-pagination/types.ts +41 -0
- package/components/oxy-password-input/index.scss +124 -0
- package/components/oxy-password-input/oxy-password-input.vue +49 -0
- package/components/oxy-password-input/types.ts +33 -0
- package/components/oxy-picker/index.scss +110 -0
- package/components/oxy-picker/oxy-picker.vue +412 -0
- package/components/oxy-picker/types.ts +189 -0
- package/components/oxy-picker-view/index.scss +92 -0
- package/components/oxy-picker-view/oxy-picker-view.vue +369 -0
- package/components/oxy-picker-view/types.ts +152 -0
- package/components/oxy-popover/index.scss +116 -0
- package/components/oxy-popover/oxy-popover.vue +180 -0
- package/components/oxy-popover/types.ts +69 -0
- package/components/oxy-popup/index.scss +84 -0
- package/components/oxy-popup/oxy-popup.vue +169 -0
- package/components/oxy-popup/types.ts +95 -0
- package/components/oxy-progress/index.scss +68 -0
- package/components/oxy-progress/oxy-progress.vue +197 -0
- package/components/oxy-progress/types.ts +35 -0
- package/components/oxy-radio/index.scss +301 -0
- package/components/oxy-radio/oxy-radio.vue +118 -0
- package/components/oxy-radio/types.ts +42 -0
- package/components/oxy-radio-group/index.scss +23 -0
- package/components/oxy-radio-group/oxy-radio-group.vue +51 -0
- package/components/oxy-radio-group/types.ts +39 -0
- package/components/oxy-rate/index.scss +25 -0
- package/components/oxy-rate/oxy-rate.vue +178 -0
- package/components/oxy-rate/types.ts +103 -0
- package/components/oxy-resize/index.scss +27 -0
- package/components/oxy-resize/oxy-resize.vue +144 -0
- package/components/oxy-resize/types.ts +6 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +50 -0
- package/components/oxy-row/index.scss +10 -0
- package/components/oxy-row/oxy-row.vue +42 -0
- package/components/oxy-row/types.ts +16 -0
- package/components/oxy-search/index.scss +148 -0
- package/components/oxy-search/oxy-search.vue +187 -0
- package/components/oxy-search/types.ts +93 -0
- package/components/oxy-segmented/index.scss +101 -0
- package/components/oxy-segmented/oxy-segmented.vue +143 -0
- package/components/oxy-segmented/types.ts +71 -0
- package/components/oxy-select-picker/index.scss +102 -0
- package/components/oxy-select-picker/oxy-select-picker.vue +432 -0
- package/components/oxy-select-picker/types.ts +123 -0
- package/components/oxy-sidebar/index.scss +25 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +63 -0
- package/components/oxy-sidebar/types.ts +38 -0
- package/components/oxy-sidebar-item/index.scss +97 -0
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +116 -0
- package/components/oxy-sidebar-item/types.ts +31 -0
- package/components/oxy-signature/index.scss +31 -0
- package/components/oxy-signature/oxy-signature.vue +630 -0
- package/components/oxy-signature/types.ts +108 -0
- package/components/oxy-skeleton/index.scss +96 -0
- package/components/oxy-skeleton/index.ts +1 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +110 -0
- package/components/oxy-skeleton/types.ts +69 -0
- package/components/oxy-slider/index.scss +98 -0
- package/components/oxy-slider/oxy-slider.vue +356 -0
- package/components/oxy-slider/types.ts +138 -0
- package/components/oxy-sort-button/index.scss +89 -0
- package/components/oxy-sort-button/oxy-sort-button.vue +69 -0
- package/components/oxy-sort-button/types.ts +43 -0
- package/components/oxy-status-tip/images/collect.png +0 -0
- package/components/oxy-status-tip/images/content.png +0 -0
- package/components/oxy-status-tip/images/network.png +0 -0
- package/components/oxy-status-tip/images/search.png +0 -0
- package/components/oxy-status-tip/index.scss +37 -0
- package/components/oxy-status-tip/oxy-status-tip.vue +71 -0
- package/components/oxy-status-tip/types.ts +50 -0
- package/components/oxy-step/index.scss +235 -0
- package/components/oxy-step/oxy-step.vue +150 -0
- package/components/oxy-step/types.ts +33 -0
- package/components/oxy-steps/index.scss +10 -0
- package/components/oxy-steps/oxy-steps.vue +28 -0
- package/components/oxy-steps/types.ts +50 -0
- package/components/oxy-sticky/index.scss +9 -0
- package/components/oxy-sticky/oxy-sticky.vue +190 -0
- package/components/oxy-sticky/types.ts +13 -0
- package/components/oxy-sticky-box/index.scss +6 -0
- package/components/oxy-sticky-box/oxy-sticky-box.vue +155 -0
- package/components/oxy-sticky-box/types.ts +11 -0
- package/components/oxy-swipe-action/index.scss +22 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +294 -0
- package/components/oxy-swipe-action/types.ts +40 -0
- package/components/oxy-swiper/index.scss +53 -0
- package/components/oxy-swiper/oxy-swiper.vue +318 -0
- package/components/oxy-swiper/types.ts +264 -0
- package/components/oxy-swiper-nav/index.scss +159 -0
- package/components/oxy-swiper-nav/oxy-swiper-nav.vue +37 -0
- package/components/oxy-swiper-nav/types.ts +42 -0
- package/components/oxy-switch/index.scss +58 -0
- package/components/oxy-switch/oxy-switch.vue +83 -0
- package/components/oxy-switch/types.ts +58 -0
- package/components/oxy-tab/index.scss +16 -0
- package/components/oxy-tab/oxy-tab.vue +88 -0
- package/components/oxy-tab/types.ts +30 -0
- package/components/oxy-tabbar/index.scss +62 -0
- package/components/oxy-tabbar/oxy-tabbar.vue +91 -0
- package/components/oxy-tabbar/types.ts +73 -0
- package/components/oxy-tabbar-item/index.scss +55 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +99 -0
- package/components/oxy-tabbar-item/types.ts +51 -0
- package/components/oxy-table/index.scss +163 -0
- package/components/oxy-table/oxy-table.vue +283 -0
- package/components/oxy-table/types.ts +58 -0
- package/components/oxy-table-col/index.scss +46 -0
- package/components/oxy-table-col/oxy-table-col.vue +149 -0
- package/components/oxy-table-col/types.ts +54 -0
- package/components/oxy-tabs/index.scss +299 -0
- package/components/oxy-tabs/oxy-tabs.vue +443 -0
- package/components/oxy-tabs/types.ts +107 -0
- package/components/oxy-tag/index.scss +115 -0
- package/components/oxy-tag/oxy-tag.vue +148 -0
- package/components/oxy-tag/types.ts +81 -0
- package/components/oxy-text/index.scss +37 -0
- package/components/oxy-text/oxy-text.vue +139 -0
- package/components/oxy-text/types.ts +98 -0
- package/components/oxy-textarea/index.scss +340 -0
- package/components/oxy-textarea/oxy-textarea.vue +296 -0
- package/components/oxy-textarea/placeholder.scss +20 -0
- package/components/oxy-textarea/types.ts +288 -0
- package/components/oxy-toast/index.scss +75 -0
- package/components/oxy-toast/index.ts +92 -0
- package/components/oxy-toast/oxy-toast.vue +198 -0
- package/components/oxy-toast/types.ts +181 -0
- package/components/oxy-tooltip/index.scss +66 -0
- package/components/oxy-tooltip/oxy-tooltip.vue +141 -0
- package/components/oxy-tooltip/types.ts +107 -0
- package/components/oxy-transition/index.scss +95 -0
- package/components/oxy-transition/oxy-transition.vue +232 -0
- package/components/oxy-transition/types.ts +98 -0
- package/components/oxy-upload/index.scss +175 -0
- package/components/oxy-upload/oxy-upload.vue +673 -0
- package/components/oxy-upload/types.ts +391 -0
- package/components/oxy-video-preview/index.scss +34 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +72 -0
- package/components/oxy-video-preview/types.ts +23 -0
- package/components/oxy-watermark/index.scss +18 -0
- package/components/oxy-watermark/oxy-watermark.vue +486 -0
- package/components/oxy-watermark/types.ts +76 -0
- package/dayjs/constant.js +26 -0
- package/dayjs/index.d.ts +430 -0
- package/dayjs/index.js +542 -0
- package/dayjs/locale/en.js +13 -0
- package/dayjs/utils.js +59 -0
- package/global.d.ts +101 -0
- package/index.ts +12 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +133 -0
- package/locale/lang/en-US.ts +133 -0
- package/locale/lang/zh-CN.ts +137 -0
- package/package.json +1 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-radio-group ${customClass} ${cell && shape === 'button' ? 'is-button' : ''}`" :style="customStyle">
|
|
3
|
+
<slot />
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
export default {
|
|
8
|
+
name: 'oxy-radio-group',
|
|
9
|
+
options: {
|
|
10
|
+
virtualHost: true,
|
|
11
|
+
addGlobalClass: true,
|
|
12
|
+
styleIsolation: 'shared'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { watch } from 'vue'
|
|
19
|
+
import { useChildren } from '../composables/useChildren'
|
|
20
|
+
import { RADIO_GROUP_KEY, radioGroupProps } from './types'
|
|
21
|
+
|
|
22
|
+
const props = defineProps(radioGroupProps)
|
|
23
|
+
const emit = defineEmits(['change', 'update:modelValue'])
|
|
24
|
+
|
|
25
|
+
const { linkChildren, children } = useChildren(RADIO_GROUP_KEY)
|
|
26
|
+
|
|
27
|
+
linkChildren({ props, updateValue })
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
() => props.shape,
|
|
31
|
+
(newValue) => {
|
|
32
|
+
// type: 'dot', 'button', 'check'
|
|
33
|
+
const type = ['check', 'dot', 'button']
|
|
34
|
+
if (type.indexOf(newValue) === -1) console.error(`shape must be one of ${type.toString()}`)
|
|
35
|
+
},
|
|
36
|
+
{ deep: true, immediate: true }
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 处理radio子节点通知
|
|
41
|
+
*/
|
|
42
|
+
function updateValue(value: string | number | boolean) {
|
|
43
|
+
emit('update:modelValue', value)
|
|
44
|
+
emit('change', {
|
|
45
|
+
value
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
<style lang="scss" scoped>
|
|
50
|
+
@import './index.scss';
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type InjectionKey } from 'vue'
|
|
2
|
+
import type { RadioShape, RadioIconPlacement } from '../oxy-radio/types'
|
|
3
|
+
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
|
|
4
|
+
|
|
5
|
+
export type RadioGroupProvide = {
|
|
6
|
+
props: {
|
|
7
|
+
modelValue?: string | number | boolean
|
|
8
|
+
shape?: RadioShape
|
|
9
|
+
checkedColor?: string
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
cell?: boolean
|
|
12
|
+
size?: string
|
|
13
|
+
inline?: boolean
|
|
14
|
+
iconPlacement?: RadioIconPlacement
|
|
15
|
+
}
|
|
16
|
+
updateValue: (value: string | number | boolean) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const RADIO_GROUP_KEY: InjectionKey<RadioGroupProvide> = Symbol('oxy-radio-group')
|
|
20
|
+
|
|
21
|
+
export const radioGroupProps = {
|
|
22
|
+
...baseProps,
|
|
23
|
+
/** 会自动选中value对应的单选框 */
|
|
24
|
+
modelValue: [String, Number, Boolean],
|
|
25
|
+
/** 单选框形状,可选值为 dot / button / check,默认为 check */
|
|
26
|
+
shape: makeStringProp<RadioShape>('check'),
|
|
27
|
+
/** 选中的颜色,默认为 #4D80F0 */
|
|
28
|
+
checkedColor: String,
|
|
29
|
+
/** 是否禁用,默认为 false */
|
|
30
|
+
disabled: makeBooleanProp(false),
|
|
31
|
+
/** 表单模式,默认为 false */
|
|
32
|
+
cell: makeBooleanProp(false),
|
|
33
|
+
/** 设置大小,默认为空 */
|
|
34
|
+
size: makeStringProp(''),
|
|
35
|
+
/** 同行展示,默认为 false */
|
|
36
|
+
inline: makeBooleanProp(false),
|
|
37
|
+
/** 图标位置,默认为 left */
|
|
38
|
+
iconPlacement: makeStringProp<RadioIconPlacement>('auto')
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin.scss';
|
|
2
|
+
@import './../common/abstracts/variable.scss';
|
|
3
|
+
|
|
4
|
+
@include b(rate) {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
|
|
9
|
+
@include e(item) {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-block;
|
|
12
|
+
touch-action: none; // 禁用默认触摸行为
|
|
13
|
+
}
|
|
14
|
+
@include edeep(item-star) {
|
|
15
|
+
-webkit-background-clip: text !important;
|
|
16
|
+
color: transparent;
|
|
17
|
+
}
|
|
18
|
+
@include e(item-half) {
|
|
19
|
+
position: absolute;
|
|
20
|
+
left: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
width: 50%;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-rate ${customClass}`" :style="customStyle" @touchmove="onTouchMove">
|
|
3
|
+
<view
|
|
4
|
+
v-for="(rate, index) in rateList"
|
|
5
|
+
:key="index"
|
|
6
|
+
:data-index="index"
|
|
7
|
+
:style="{ 'margin-right': index == rateList.length - 1 ? 0 : space }"
|
|
8
|
+
class="oxy-rate__item"
|
|
9
|
+
>
|
|
10
|
+
<oxy-icon
|
|
11
|
+
custom-class="oxy-rate__item-star"
|
|
12
|
+
:name="isActive(rate) ? activeIcon : icon"
|
|
13
|
+
:size="size"
|
|
14
|
+
:custom-style="rate === '100%' ? iconActiveStyle : iconStyle"
|
|
15
|
+
@click="handleClick(index, false)"
|
|
16
|
+
/>
|
|
17
|
+
<view v-if="props.allowHalf" class="oxy-rate__item-half" @click.stop="handleClick(index, true)">
|
|
18
|
+
<oxy-icon
|
|
19
|
+
custom-class="oxy-rate__item-star"
|
|
20
|
+
:name="isActive(rate) ? activeIcon : icon"
|
|
21
|
+
:size="size"
|
|
22
|
+
:custom-style="rate !== '0' ? iconActiveStyle : iconStyle"
|
|
23
|
+
/>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
export default {
|
|
31
|
+
name: 'oxy-rate',
|
|
32
|
+
options: {
|
|
33
|
+
addGlobalClass: true,
|
|
34
|
+
virtualHost: true,
|
|
35
|
+
styleIsolation: 'shared'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
41
|
+
import { computed, getCurrentInstance, ref, watch } from 'vue'
|
|
42
|
+
import { rateProps } from './types'
|
|
43
|
+
import { getRect } from '../common/util'
|
|
44
|
+
const { proxy } = getCurrentInstance() as any
|
|
45
|
+
|
|
46
|
+
const props = defineProps(rateProps)
|
|
47
|
+
const emit = defineEmits(['update:modelValue', 'change'])
|
|
48
|
+
|
|
49
|
+
const rateList = ref<Array<string>>([])
|
|
50
|
+
const activeValue = ref<string>('')
|
|
51
|
+
|
|
52
|
+
const iconStyle = computed(() => {
|
|
53
|
+
return `background:${props.color};`
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const iconActiveStyle = computed(() => {
|
|
57
|
+
return `background:${props.disabled ? props.disabledColor : activeValue.value};`
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
watch(
|
|
61
|
+
() => props.activeColor,
|
|
62
|
+
(newVal) => {
|
|
63
|
+
if (Array.isArray(newVal) && !newVal.length) {
|
|
64
|
+
console.error('activeColor cannot be an empty array')
|
|
65
|
+
}
|
|
66
|
+
computeActiveValue()
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
immediate: true,
|
|
70
|
+
deep: true
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
watch(
|
|
75
|
+
[() => props.num, () => props.modelValue],
|
|
76
|
+
() => {
|
|
77
|
+
computeRateList()
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
immediate: true,
|
|
81
|
+
deep: true
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
// 当前选项是否为激活状态
|
|
86
|
+
const isActive = (rate: string) => {
|
|
87
|
+
return rate !== '0'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @description 计算当前应当展示的rate数量
|
|
92
|
+
*/
|
|
93
|
+
function computeRateList() {
|
|
94
|
+
const { modelValue, num, allowHalf } = props
|
|
95
|
+
// value和num都准备好才能计算
|
|
96
|
+
if (modelValue === null || !num) return
|
|
97
|
+
if (typeof modelValue !== 'number') {
|
|
98
|
+
console.error('[Oxy ui] error(oxy-rate): the value of oxy-rate should be a number')
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
const tempRateList: string[] = []
|
|
102
|
+
const fullLength = Math.floor(modelValue)
|
|
103
|
+
for (let i = 0; i < num; i++) {
|
|
104
|
+
if (i < fullLength) {
|
|
105
|
+
tempRateList.push('100%')
|
|
106
|
+
} else if (i === fullLength && allowHalf && modelValue % 1 !== 0) {
|
|
107
|
+
tempRateList.push('50%')
|
|
108
|
+
} else {
|
|
109
|
+
tempRateList.push('0')
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
rateList.value = tempRateList
|
|
113
|
+
computeActiveValue()
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @description 计算当前应当展示的rate颜色
|
|
117
|
+
*/
|
|
118
|
+
function computeActiveValue() {
|
|
119
|
+
const { activeColor, modelValue, num } = props
|
|
120
|
+
let tempActiveValue: string = ''
|
|
121
|
+
if (Array.isArray(activeColor) && activeColor.length) {
|
|
122
|
+
tempActiveValue = Number(modelValue) <= num * 0.6 || !activeColor[1] ? activeColor[0] : activeColor[1]
|
|
123
|
+
} else {
|
|
124
|
+
tempActiveValue = activeColor as string
|
|
125
|
+
}
|
|
126
|
+
activeValue.value = tempActiveValue
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @description 处理点击事件
|
|
131
|
+
* @param index 点击的索引
|
|
132
|
+
* @param isHalf 是否为半星
|
|
133
|
+
*/
|
|
134
|
+
function handleClick(index: number, isHalf: boolean) {
|
|
135
|
+
const { readonly, disabled, clearable, allowHalf, modelValue } = props
|
|
136
|
+
if (readonly || disabled) return
|
|
137
|
+
let value = isHalf ? index + 0.5 : index + 1
|
|
138
|
+
// 点击清空逻辑:当点击的值与当前modelValue相等且等于最小值时允许清空
|
|
139
|
+
if (clearable) {
|
|
140
|
+
const minValue = allowHalf ? 0.5 : 1
|
|
141
|
+
if (value === modelValue && value === minValue) {
|
|
142
|
+
value = 0
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
updateValue(value)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @description 设置评分值并触发事件
|
|
150
|
+
*/
|
|
151
|
+
function updateValue(value: number) {
|
|
152
|
+
emit('update:modelValue', value)
|
|
153
|
+
emit('change', {
|
|
154
|
+
value
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function onTouchMove(event: TouchEvent) {
|
|
159
|
+
const { clientX } = event.touches[0]
|
|
160
|
+
const rateItems = await getRect('.oxy-rate__item', true, proxy)
|
|
161
|
+
const targetIndex = Array.from(rateItems).findIndex((rect) => {
|
|
162
|
+
return clientX >= rect.left! && clientX <= rect.right!
|
|
163
|
+
})
|
|
164
|
+
if (targetIndex !== -1) {
|
|
165
|
+
const target = rateItems[targetIndex]
|
|
166
|
+
const itemWidth = target.width!
|
|
167
|
+
const isHalf = props.allowHalf && clientX - target.left! < itemWidth / 2
|
|
168
|
+
const value = isHalf ? targetIndex + 0.5 : targetIndex + 1
|
|
169
|
+
if (value >= 0.5) {
|
|
170
|
+
const value = isHalf ? targetIndex + 0.5 : targetIndex + 1
|
|
171
|
+
updateValue(value)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
<style lang="scss" scoped>
|
|
177
|
+
@import './index.scss';
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const rateProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 评分最大值
|
|
9
|
+
* 类型: number
|
|
10
|
+
* 默认值: 5
|
|
11
|
+
*/
|
|
12
|
+
num: makeNumberProp(5),
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 当前分数,使用v-model进行双向绑定
|
|
16
|
+
* 类型: string | number | null
|
|
17
|
+
* 默认值: null
|
|
18
|
+
*/
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: [String, Number, null] as PropType<string | number | null>,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 是否只读
|
|
26
|
+
* 类型: boolean
|
|
27
|
+
* 默认值: false
|
|
28
|
+
*/
|
|
29
|
+
readonly: makeBooleanProp(false),
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 图标大小
|
|
33
|
+
* 类型: string
|
|
34
|
+
* 默认值: '16px'
|
|
35
|
+
*/
|
|
36
|
+
size: makeStringProp('16px'),
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 图标间距
|
|
40
|
+
* 类型: string
|
|
41
|
+
* 默认值: '4px'
|
|
42
|
+
*/
|
|
43
|
+
space: makeStringProp('4px'),
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 未选中的图标颜色
|
|
47
|
+
* 类型: string
|
|
48
|
+
* 默认值: '#E8E8E8'
|
|
49
|
+
*/
|
|
50
|
+
color: makeStringProp('#E8E8E8'),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 选中的图标颜色,支持传颜色数组(用于分段颜色)
|
|
54
|
+
* 类型: string | Array<string>
|
|
55
|
+
* 默认值: 'linear-gradient(180deg, rgba(255,238,0,1) 0%,rgba(250,176,21,1) 100%)'
|
|
56
|
+
*/
|
|
57
|
+
activeColor: {
|
|
58
|
+
type: [String, Array] as PropType<string | Array<string>>,
|
|
59
|
+
default: 'linear-gradient(180deg, rgba(255,238,0,1) 0%,rgba(250,176,21,1) 100%)'
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 未选中的图标类名
|
|
64
|
+
* 类型: string
|
|
65
|
+
* 默认值: 'star-on'
|
|
66
|
+
*/
|
|
67
|
+
icon: makeStringProp('star-on'),
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 选中的图标类名
|
|
71
|
+
* 类型: string
|
|
72
|
+
* 默认值: 'star-on'
|
|
73
|
+
*/
|
|
74
|
+
activeIcon: makeStringProp('star-on'),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 是否禁用
|
|
78
|
+
* 类型: boolean
|
|
79
|
+
* 默认值: false
|
|
80
|
+
*/
|
|
81
|
+
disabled: makeBooleanProp(false),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 禁用的图标颜色
|
|
85
|
+
* 类型: string
|
|
86
|
+
* 默认值: 'linear-gradient(315deg, rgba(177,177,177,1) 0%,rgba(199,199,199,1) 100%)'
|
|
87
|
+
*/
|
|
88
|
+
disabledColor: makeStringProp('linear-gradient(315deg, rgba(177,177,177,1) 0%,rgba(199,199,199,1) 100%)'),
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 是否允许半选
|
|
92
|
+
* 类型: boolean
|
|
93
|
+
* 默认值: false
|
|
94
|
+
*/
|
|
95
|
+
allowHalf: makeBooleanProp(false),
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 当 clearable 属性设置为 true,再次点击相同的值时,可以将值重置为 0。
|
|
99
|
+
* 类型: boolean
|
|
100
|
+
* 默认值: false
|
|
101
|
+
*/
|
|
102
|
+
clearable: makeBooleanProp(false)
|
|
103
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../common/abstracts/variable';
|
|
2
|
+
@import '../common/abstracts/mixin';
|
|
3
|
+
|
|
4
|
+
@include b(resize) {
|
|
5
|
+
|
|
6
|
+
@include e(container) {
|
|
7
|
+
position: absolute;
|
|
8
|
+
min-width: 1px;
|
|
9
|
+
min-height: 1px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@include e(wrapper) {
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
z-index: -9999;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
visibility: hidden;
|
|
21
|
+
|
|
22
|
+
@include m(placeholder) {
|
|
23
|
+
transition: 0s;
|
|
24
|
+
animation: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-resize ${customClass}`" :style="rootStyle">
|
|
3
|
+
<!--插槽需要脱离父容器文档流,防止父容器固宽固高,进而导致插槽大小被被父容器限制-->
|
|
4
|
+
<view :id="resizeId" :class="`oxy-resize__container ${customContainerClass}`">
|
|
5
|
+
<!--被监听的插槽-->
|
|
6
|
+
<slot />
|
|
7
|
+
<!--监听插槽变大-->
|
|
8
|
+
<scroll-view
|
|
9
|
+
class="oxy-resize__wrapper"
|
|
10
|
+
:scroll-y="true"
|
|
11
|
+
:scroll-top="expandScrollTop"
|
|
12
|
+
:scroll-x="true"
|
|
13
|
+
:scroll-left="expandScrollLeft"
|
|
14
|
+
@scroll="onScrollHandler"
|
|
15
|
+
>
|
|
16
|
+
<view class="oxy-resize__wrapper--placeholder" style="height: 100000px; width: 100000px"></view>
|
|
17
|
+
</scroll-view>
|
|
18
|
+
<!--监听插槽变小-->
|
|
19
|
+
<scroll-view
|
|
20
|
+
class="oxy-resize__wrapper"
|
|
21
|
+
:scroll-y="true"
|
|
22
|
+
:scroll-top="shrinkScrollTop"
|
|
23
|
+
:scroll-x="true"
|
|
24
|
+
:scroll-left="shrinkScrollLeft"
|
|
25
|
+
@scroll="onScrollHandler"
|
|
26
|
+
>
|
|
27
|
+
<view class="oxy-resize__wrapper--placeholder" style="height: 250%; width: 250%"></view>
|
|
28
|
+
</scroll-view>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
export default {
|
|
35
|
+
name: 'oxy-resize',
|
|
36
|
+
options: {
|
|
37
|
+
virtualHost: true,
|
|
38
|
+
addGlobalClass: true,
|
|
39
|
+
styleIsolation: 'shared'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import { computed, getCurrentInstance, onMounted, ref } from 'vue'
|
|
46
|
+
import { addUnit, objToStyle, uuid } from '../common/util'
|
|
47
|
+
import { resizeProps } from './types'
|
|
48
|
+
|
|
49
|
+
const props = defineProps(resizeProps)
|
|
50
|
+
const emit = defineEmits(['resize'])
|
|
51
|
+
|
|
52
|
+
const expandScrollTop = ref<number>(0)
|
|
53
|
+
const shrinkScrollTop = ref<number>(0)
|
|
54
|
+
const expandScrollLeft = ref<number>(0)
|
|
55
|
+
const shrinkScrollLeft = ref<number>(0)
|
|
56
|
+
const height = ref<number>(0)
|
|
57
|
+
const width = ref<number>(0)
|
|
58
|
+
const scrollEventCount = ref<number>(0)
|
|
59
|
+
|
|
60
|
+
const rootStyle = computed(() => {
|
|
61
|
+
const style: Record<string, string | number> = {
|
|
62
|
+
width: addUnit(width.value),
|
|
63
|
+
height: addUnit(height.value)
|
|
64
|
+
}
|
|
65
|
+
return `${objToStyle(style)}${props.customStyle}`
|
|
66
|
+
})
|
|
67
|
+
let onScrollHandler = () => {}
|
|
68
|
+
const { proxy } = getCurrentInstance() as any
|
|
69
|
+
|
|
70
|
+
const resizeId = ref<string>(`resize${uuid()}`)
|
|
71
|
+
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
// 初始化数据获取
|
|
74
|
+
const query = uni.createSelectorQuery().in(proxy).select(`#${resizeId.value}`).boundingClientRect()
|
|
75
|
+
query.exec(([res]) => {
|
|
76
|
+
// 闭包记录容器高度
|
|
77
|
+
let lastHeight = res.height
|
|
78
|
+
let lastWidth = res.width
|
|
79
|
+
// 立即填充父容器高宽
|
|
80
|
+
height.value = lastHeight
|
|
81
|
+
width.value = lastWidth
|
|
82
|
+
// 监听滚动事件
|
|
83
|
+
onScrollHandler = () => {
|
|
84
|
+
const query = uni.createSelectorQuery().in(proxy).select(`#${resizeId.value}`).boundingClientRect()
|
|
85
|
+
query.exec(([res]) => {
|
|
86
|
+
// 前两次滚动事件被触发,说明 created 的修改已渲染,通知用户代码当前容器大小
|
|
87
|
+
if (scrollEventCount.value++ === 0) {
|
|
88
|
+
const result: Record<string, string | number> = {}
|
|
89
|
+
;['bottom', 'top', 'left', 'right', 'height', 'width'].forEach((propName) => {
|
|
90
|
+
result[propName] = res[propName]
|
|
91
|
+
})
|
|
92
|
+
emit('resize', result)
|
|
93
|
+
}
|
|
94
|
+
// 滚动条拉到底部会触发两次多余的事件,屏蔽掉。
|
|
95
|
+
if (scrollEventCount.value < 3) return
|
|
96
|
+
// 手动设置父容器高宽,防止父容器坍塌
|
|
97
|
+
// 滚动完,重新获取容器新的高度
|
|
98
|
+
const newHeight = res.height
|
|
99
|
+
const newWidth = res.width
|
|
100
|
+
// 立即填充父容器高宽
|
|
101
|
+
height.value = newHeight
|
|
102
|
+
width.value = newWidth
|
|
103
|
+
// 宽高都改变时,只需要触发一次 size 事件
|
|
104
|
+
const emitStack: number[] = []
|
|
105
|
+
if (newHeight !== lastHeight) {
|
|
106
|
+
lastHeight = newHeight
|
|
107
|
+
emitStack.push(1)
|
|
108
|
+
}
|
|
109
|
+
if (newWidth !== lastWidth) {
|
|
110
|
+
lastWidth = newWidth
|
|
111
|
+
emitStack.push(1)
|
|
112
|
+
}
|
|
113
|
+
if (emitStack.length !== 0) {
|
|
114
|
+
const result: Record<string, any> = {}
|
|
115
|
+
;['bottom', 'top', 'left', 'right', 'height', 'width'].forEach((propName) => {
|
|
116
|
+
result[propName] = res[propName]
|
|
117
|
+
})
|
|
118
|
+
emit('resize', result)
|
|
119
|
+
}
|
|
120
|
+
// 滚动条拉到底部(如果使用 nextTick 效果更佳)
|
|
121
|
+
scrollToBottom({
|
|
122
|
+
lastWidth: lastWidth,
|
|
123
|
+
lastHeight: lastHeight
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
// 滚动条拉到底部(如果使用 nextTick 效果更佳)
|
|
128
|
+
scrollToBottom({
|
|
129
|
+
lastWidth: lastWidth,
|
|
130
|
+
lastHeight: lastHeight
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
function scrollToBottom({ lastWidth, lastHeight }: { lastWidth: number; lastHeight: number }) {
|
|
136
|
+
expandScrollTop.value = 100000 + lastHeight
|
|
137
|
+
shrinkScrollTop.value = 3 * height.value + lastHeight
|
|
138
|
+
expandScrollLeft.value = 100000 + lastWidth
|
|
139
|
+
shrinkScrollLeft.value = 3 * width.value + lastWidth
|
|
140
|
+
}
|
|
141
|
+
</script>
|
|
142
|
+
<style lang="scss" scoped>
|
|
143
|
+
@import './index.scss';
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<!-- H5端使用 teleport -->
|
|
4
|
+
<teleport to="body">
|
|
5
|
+
<!-- #endif -->
|
|
6
|
+
<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
|
|
7
|
+
<!-- #ifndef MP-DINGTALK -->
|
|
8
|
+
<!-- 小程序使用 root-portal -->
|
|
9
|
+
<root-portal>
|
|
10
|
+
<!-- #endif -->
|
|
11
|
+
<!-- #endif -->
|
|
12
|
+
<slot />
|
|
13
|
+
<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
|
|
14
|
+
<!-- #ifndef MP-DINGTALK -->
|
|
15
|
+
</root-portal>
|
|
16
|
+
<!-- #endif -->
|
|
17
|
+
<!-- #endif -->
|
|
18
|
+
<!-- #ifdef H5 -->
|
|
19
|
+
</teleport>
|
|
20
|
+
<!-- #endif -->
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: 'oxy-root-portal',
|
|
25
|
+
options: {
|
|
26
|
+
virtualHost: true,
|
|
27
|
+
addGlobalClass: true,
|
|
28
|
+
styleIsolation: 'shared'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
<script lang="ts" setup></script>
|
|
33
|
+
|
|
34
|
+
<!-- #ifdef APP-PLUS -->
|
|
35
|
+
<script module="render" lang="renderjs">
|
|
36
|
+
export default {
|
|
37
|
+
mounted() {
|
|
38
|
+
if (this.$ownerInstance.$el) {
|
|
39
|
+
(document.querySelector('uni-app') || document.body).appendChild(this.$ownerInstance.$el)
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
beforeDestroy() {
|
|
43
|
+
// 清理,将元素移回原位置
|
|
44
|
+
if (this.$ownerInstance.$el) {
|
|
45
|
+
(document.querySelector('uni-app') || document.body).removeChild(this.$ownerInstance.$el)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
<!-- #endif -->
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-row ${customClass}`" :style="rowStyle">
|
|
3
|
+
<!-- 每一行 -->
|
|
4
|
+
<slot />
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'oxy-row',
|
|
10
|
+
options: {
|
|
11
|
+
virtualHost: true,
|
|
12
|
+
addGlobalClass: true,
|
|
13
|
+
styleIsolation: 'shared'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { computed, type CSSProperties } from 'vue'
|
|
19
|
+
import { useChildren } from '../composables/useChildren'
|
|
20
|
+
import { ROW_KEY, rowProps } from './types'
|
|
21
|
+
import { addUnit, objToStyle } from '../common/util'
|
|
22
|
+
|
|
23
|
+
const props = defineProps(rowProps)
|
|
24
|
+
const { linkChildren } = useChildren(ROW_KEY)
|
|
25
|
+
|
|
26
|
+
linkChildren({ props })
|
|
27
|
+
|
|
28
|
+
const rowStyle = computed(() => {
|
|
29
|
+
const style: CSSProperties = {}
|
|
30
|
+
const { gutter } = props
|
|
31
|
+
if (gutter < 0) {
|
|
32
|
+
console.error('[Oxy ui] warning(oxy-row): attribute gutter must be greater than or equal to 0')
|
|
33
|
+
} else if (gutter) {
|
|
34
|
+
style.marginLeft = addUnit(gutter / 2)
|
|
35
|
+
style.marginRight = addUnit(gutter / 2)
|
|
36
|
+
}
|
|
37
|
+
return `${objToStyle(style)}${props.customStyle}`
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
@import './index.scss';
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type InjectionKey } from 'vue'
|
|
2
|
+
import { baseProps, makeNumberProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export type RowProvide = {
|
|
5
|
+
props: { gutter?: number }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ROW_KEY: InjectionKey<RowProvide> = Symbol('oxy-row')
|
|
9
|
+
|
|
10
|
+
export const rowProps = {
|
|
11
|
+
...baseProps,
|
|
12
|
+
/**
|
|
13
|
+
* 列元素之间的间距(单位为px)
|
|
14
|
+
*/
|
|
15
|
+
gutter: makeNumberProp(0)
|
|
16
|
+
}
|