diff --git a/package/component/package.json b/package/component/package.json index 15f91798..fd08e3d1 100644 --- a/package/component/package.json +++ b/package/component/package.json @@ -1,6 +1,6 @@ { "name": "@layui/layui-vue", - "version": "1.7.6", + "version": "1.7.7-alpha.1", "author": "就眠儀式", "license": "MIT", "description": "a component library for Vue 3 base on layui-vue", diff --git a/package/component/src/component/popper/calcPosition.ts b/package/component/src/component/popper/calcPosition.ts index ec10e87c..3992b8d1 100644 --- a/package/component/src/component/popper/calcPosition.ts +++ b/package/component/src/component/popper/calcPosition.ts @@ -14,6 +14,8 @@ const postionFns: any = { ) { innnerPosition.value = "bottom"; top = bottom; + } else { + innnerPosition.value = "top"; } return { top: `${top}px`, @@ -30,6 +32,8 @@ const postionFns: any = { if (window.innerHeight - bottom < popper.offsetHeight + 6) { innnerPosition.value = "top"; bottom = top - popper.offsetHeight - 6; + } else { + innnerPosition.value = "bottom"; } return { top: `${bottom}px`, @@ -47,6 +51,8 @@ const postionFns: any = { if (left < 0) { innnerPosition.value = "right"; left = right; + } else { + innnerPosition.value = "left"; } return { top: `${top - (popper.offsetHeight - el.offsetHeight) / 2}px`, @@ -63,6 +69,8 @@ const postionFns: any = { if (window.innerWidth < right + popper.offsetWidth + 6) { innnerPosition.value = "left"; right = left - popper.offsetWidth - 6; + } else { + innnerPosition.value = "right"; } return { top: `${top - (popper.offsetHeight - el.offsetHeight) / 2}px`, diff --git a/package/component/src/component/popper/index.vue b/package/component/src/component/popper/index.vue index 547ba1f3..7a0722e6 100644 --- a/package/component/src/component/popper/index.vue +++ b/package/component/src/component/popper/index.vue @@ -9,7 +9,7 @@ @mouseenter="handlerPopperMouseEnter" @mouseleave="handlerPopperMouseLeave" > - {{ content }} + {{ content }}
@@ -110,6 +110,7 @@ const doHidden = function (e?: MouseEvent) { }; const calcPosistion = function () { + postionFns[props.position] && (style.value = postionFns[props.position]( triggerRefEl.value, @@ -120,9 +121,7 @@ const calcPosistion = function () { const updatePosistion = function () { if (innerVisible.value) { - popperRefEl.value.offsetWidth === 0 - ? nextTick(() => calcPosistion()) - : calcPosistion(); + popperRefEl.value.offsetWidth === 0 ? nextTick(() => calcPosistion()) : calcPosistion(); nextTick(() => { calcPosistion(); }); diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index 8bfaeb59..7f1fc555 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -79,7 +79,12 @@ const getOption = (nodes: VNode[], newOptions: any[]) => { if (component.name == LaySelectOption.name) { if (item.children) { // @ts-ignore - item.props.label = item.children.default()[0].children; + const label = item.children.default()[0].children; + + if(typeof label == "string") { + // @ts-ignore + item.props.label = label; + } } newOptions.push(item.props); } diff --git a/package/component/src/component/upload/index.vue b/package/component/src/component/upload/index.vue index 2cda8342..5f9ad831 100644 --- a/package/component/src/component/upload/index.vue +++ b/package/component/src/component/upload/index.vue @@ -68,6 +68,8 @@ export interface UploadProps { disabledPreview?: boolean; cut?: boolean; cutOptions?: CutOptions; + text?: string; + dragText?: string; } const getCutDownResult = () => { @@ -103,8 +105,8 @@ const clearAllCutEffect = () => { }; const { t } = useI18n(); -const text = computed(() => t("upload.text")); -const dragText = computed(() => t("upload.dragText")); +const text = computed(() =>{ return props.text ? props.text : t("upload.text")}); +const dragText = computed(() => { return props.dragText ? props.dragText : t("upload.dragText")}); const defaultErrorMsg = computed(() => t("upload.defaultErrorMsg")); const urlErrorMsg = computed(() => t("upload.urlErrorMsg")); const numberErrorMsg = computed(() => t("upload.numberErrorMsg")); diff --git a/package/document-component/src/document/zh-CN/components/select.md b/package/document-component/src/document/zh-CN/components/select.md index 91ee4f42..e89c41e3 100644 --- a/package/document-component/src/document/zh-CN/components/select.md +++ b/package/document-component/src/document/zh-CN/components/select.md @@ -16,7 +16,7 @@ - 运动 + @@ -47,7 +47,7 @@ export default { - change :{{value2}} + change :{{value2}} @@ -117,15 +117,15 @@ export default { @@ -290,6 +290,35 @@ export default { ::: +::: title 定制选项 +::: + +::: demo 使用 `lay-select` 标签, 创建下拉选择框 + + + + + +::: + + ::: title Select 属性 ::: diff --git a/package/document-component/src/document/zh-CN/components/tooltip.md b/package/document-component/src/document/zh-CN/components/tooltip.md index dafd989c..58985e90 100644 --- a/package/document-component/src/document/zh-CN/components/tooltip.md +++ b/package/document-component/src/document/zh-CN/components/tooltip.md @@ -84,21 +84,21 @@ export default {