diff --git a/src/components/m-parent.vue/m-child.vue b/src/components/m-parent.vue/m-child.vue index baae21a7c..dea23e856 100644 --- a/src/components/m-parent.vue/m-child.vue +++ b/src/components/m-parent.vue/m-child.vue @@ -45,11 +45,29 @@ export default { return; } - const index = parentVM.$slots.default ? parentVM.$slots.default.indexOf(this.$vnode) : -1; - if (~index) + if (!parentVM.$slots.default || !parentVM.$slots.default.length) { + parentVM.itemVMs.push(this); + return; + } + + const defaultSlots = parentVM.$slots.default; + const currentSlotIndex = defaultSlots.indexOf(this.$vnode); + if (currentSlotIndex === -1) { + parentVM.itemVMs.push(this); + return; + } + + // 根据 slot.default 位置,进行插入 + const index = parentVM.itemVMs.findIndex((itemVM) => { + const slotIndex = defaultSlots.indexOf(itemVM.$vnode); + return slotIndex > currentSlotIndex; + }); + + if (index !== -1) { parentVM.itemVMs.splice(index, 0, this); - else + } else { parentVM.itemVMs.push(this); + } }); !this.groupVM && this.$contact(this.$options.groupName, (groupVM) => { diff --git a/src/components/u-date-picker.vue/index.vue b/src/components/u-date-picker.vue/index.vue index 600b32485..7a8cb1eae 100644 --- a/src/components/u-date-picker.vue/index.vue +++ b/src/components/u-date-picker.vue/index.vue @@ -377,6 +377,7 @@ export default { .root { display: inline-block; position: relative; + max-width: 100%; /* 防止表格等小的地方超出区域 */ width: var(--datepicker-input-width); } diff --git a/src/components/u-date-picker.vue/range.vue b/src/components/u-date-picker.vue/range.vue index c74d5f0be..9ab05812f 100644 --- a/src/components/u-date-picker.vue/range.vue +++ b/src/components/u-date-picker.vue/range.vue @@ -412,6 +412,7 @@ export default { .root { display: inline-block; position: relative; + max-width: 100%; /* 防止表格等小的地方超出区域 */ width: var(--datepicker-range-input-width); } diff --git a/src/components/u-form.vue/item.vue b/src/components/u-form.vue/item.vue index b3f8e2eca..5dc8d287f 100644 --- a/src/components/u-form.vue/item.vue +++ b/src/components/u-form.vue/item.vue @@ -279,10 +279,23 @@ export default { .root[layout="block"] > .field { vertical-align: top; } -.root[layout="center"]{ +.root[layout="center"] { display: flex; align-items: center; } + +.root[layout="center"] .label { + flex-shrink: 0; +} + +.root[layout="center"] .field { + flex: 1; +} + +.root[layout="center"] .wrap { + width: 100%; +} + .root[layout="end"]{ display: flex; align-items: flex-end; diff --git a/src/components/u-modal.vue/index.vue b/src/components/u-modal.vue/index.vue index fe2b4048d..2e7cf15f3 100644 --- a/src/components/u-modal.vue/index.vue +++ b/src/components/u-modal.vue/index.vue @@ -9,7 +9,7 @@ leave-active-class="animate__animated animate__fadeOutUpSmall animate__fast">
+ :style="{ width: width + 'px' }" :size="size" @click.stop="noop">
@@ -184,6 +184,8 @@ export const UModal = { if (this.maskClose && !this.$refs.dialog.contains(e.target)) this.close(); }, + noop() { // 因为dialog 直接用overlay 套了实际额内容,导致只能stop 方式阻止事件冒泡.... + }, }, install(Vue, id) { const Ctor = Vue.component(id); diff --git a/src/components/u-select.vue/index.vue b/src/components/u-select.vue/index.vue index 8f7c9757e..72dd29039 100644 --- a/src/components/u-select.vue/index.vue +++ b/src/components/u-select.vue/index.vue @@ -319,12 +319,18 @@ export default { }, created() { this.$watch('selectedVM', (selectedVM, oldVM) => { - if (selectedVM && oldVM && selectedVM.currentText === oldVM.currentText) + if (selectedVM && oldVM && selectedVM.currentText === oldVM.currentText) { return; - if (this.filterable) - this.filterText = this.selectedVM ? this.selectedVM.currentText : ''; - else + } + if (this.filterable) { + if (this.selectedVM) { + this.filterText = this.selectedVM.currentText; + } + // blur 事件会处理这个未搜索到置空的问题 + // this.filterText = ? this.selectedVM.currentText : ''; + } else { this.currentText = this.selectedVM ? this.selectedVM.currentText : ''; + } }); this.$watch('selectedVMs', (selectedVMs) => { this.currentText = selectedVMs diff --git a/src/components/u-tabs.vue/__tests__/__snapshots__/demo.test.js.snap b/src/components/u-tabs.vue/__tests__/__snapshots__/demo.test.js.snap index ebff34765..1297a9b61 100644 --- a/src/components/u-tabs.vue/__tests__/__snapshots__/demo.test.js.snap +++ b/src/components/u-tabs.vue/__tests__/__snapshots__/demo.test.js.snap @@ -1782,6 +1782,94 @@ exports[`u-tabs.vue Demo-路由 1`] = `
`; +exports[`u-tabs.vue Demo-随机添加测试 1`] = ` +
+
+ + +
+
+
模板内容 +
+ + + + + + + + + +
+
+`; + exports[`u-tabs.vue Demo-默认显示和可关闭 1`] = `
diff --git a/src/components/u-tabs.vue/docs/cases.md b/src/components/u-tabs.vue/docs/cases.md index f0449404d..2cfe6e038 100644 --- a/src/components/u-tabs.vue/docs/cases.md +++ b/src/components/u-tabs.vue/docs/cases.md @@ -1,3 +1,62 @@ +### 随机添加测试 +```vue + + +``` + ### 形态 #### text