🐛(tooltip / select): 优化 select 自定义选项与 tooltip 边缘三角方向问题
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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`,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
@mouseenter="handlerPopperMouseEnter"
|
||||
@mouseleave="handlerPopperMouseLeave"
|
||||
>
|
||||
<slot>{{ content }}</slot>
|
||||
<slot> {{ content }}</slot>
|
||||
<div class="layui-popper-arrow"></div>
|
||||
</div>
|
||||
</transition>
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user