Skip to content

Commit

Permalink
fix: 修复了select异常
Browse files Browse the repository at this point in the history
  • Loading branch information
AnsGoo committed Oct 26, 2023
1 parent 472f9cb commit d9d69f8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/base/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class CustomComponent {
// 检测变化
propIsChange = true
styleIsChange = true
defaultViewType: ContainerType = ContainerType.COLLAPSE
defaultViewType: ContainerType = ContainerType.CARD

// form表单中使用
_prop: MetaContainerItem[] = []
Expand Down
2 changes: 1 addition & 1 deletion src/designer/modules/form/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineComponent({
mode: {
type: String as PropType<ContainerType>,
required: false,
defalut: ContainerType.COLLAPSE
defalut: ContainerType.CARD
},
flat: {
type: Boolean as PropType<boolean>,
Expand Down
39 changes: 1 addition & 38 deletions src/ui/Select/SelectDown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch }
import { Close } from '../Icon'
import Tag from '../Tag/Tag.vue'
import { Transition as OTransition } from '../Transition'
import { getOffset, getWindow } from '../util/dom'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -196,7 +195,6 @@ const downToggle = (evt: MouseEvent) => {
state.visible = true
nextTick(() => {
setPosition(evt)
setAppendToBodyStyle()
})
emits('toggleClick', state.visible, evt)
// 设置为true不触发document点击的关闭事件,解决一个页面多次使用组件时,点击时可将展开中的收起
Expand Down Expand Up @@ -266,33 +264,6 @@ const keyupEnter = (evt: Event) => {
emits('keyupEnter', value)
}
// 计算插入body的位置样式
const setAppendToBodyStyle = () => {
const offset = getOffset(el.value)
if (props.appendToBody) {
const ww = getWindow()
state.appendStyle = {
bottom: 'auto',
width: offset.width + 'px',
left: offset.left + 'px',
top: offset.top + offset.height + 8 + 'px'
}
if (state.direction2 === 2) {
// 向上
state.appendStyle.top = 'auto'
state.appendStyle.bottom = ww.height - offset.top + 'px'
}
} else {
console.log(offset)
state.appendStyle.top = offset.height * 4 + 'px'
state.appendStyle.bottom = 'auto'
state.appendStyle.width = offset.width + 'px'
if (state.direction2 === 2) {
// 向上
state.appendStyle.top = 'auto'
state.appendStyle.bottom = offset.height + 8 + 'px'
}
}
}
const setPosition = (evt: MouseEvent) => {
if (props.direction === 0) {
state.direction2 = props.direction
Expand All @@ -318,15 +289,7 @@ const downHeightStyle: any = computed(() => {
return {}
})
const downPanelStyle = computed(() => {
/*let style = {}*/
/*if (props.downHeight) {
style = {
'max-height': props.downHeight + 'px',
overflowY: 'auto'
}
}*/
// style = Object.assign({}, state.appendStyle, props.downStyle || {})
return Object.assign({}, state.appendStyle, props.downStyle || {})
return Object.assign({}, props.downStyle || {})
})
onMounted(() => {
Expand Down
12 changes: 7 additions & 5 deletions src/ui/Select/selectDown.less
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@
}
}
.o-select-down-pane {
@apply w-full dark:bg-zinc-800 bg-white box-border rounded fixed;
top:124px;
box-sizing: border-box;
width: 100%;
@apply w-full dark:bg-zinc-800 bg-white box-border rounded relative top-1;
z-index: 50;
display: inline-block;
box-shadow: 0 0 12px rgba(0, 0, 0, .12);
Expand All @@ -160,12 +157,17 @@
border-width: 5px;
border-top-width: 0;
@apply border-b-zinc-50 dark:border-b-zinc-500;
top: 1px;left: -5px}
top: 1px;
left: -5px
}
&.is-range {
left: 50%;transform: translateX(-50%);
}
}
&.top {
position: relative;
top:auto;
bottom:208px;
.down-arrow {
top: auto;
bottom: -5px;
Expand Down

0 comments on commit d9d69f8

Please sign in to comment.