Skip to content

Commit

Permalink
🐞 fix: 修复少量bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoJiKun committed Aug 17, 2022
1 parent f41f81c commit 3398261
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 178 deletions.
2 changes: 1 addition & 1 deletion lib/preview-image.js

Large diffs are not rendered by default.

315 changes: 160 additions & 155 deletions lib/preview-image.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/preview-image.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fox-preview-image",
"description": "一个支持vue2和vue3的预览图片组件",
"version": "2.5.0",
"version": "2.5.1",
"main": "lib/preview-image.umd.js",
"module": "lib/preview-image.mjs",
"browser": "lib/preview-image.umd.js",
Expand Down
43 changes: 24 additions & 19 deletions src/components/preview-image/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default defineComponent({
},
},
setup(props, { emit }) {
const bodyStyleCache = ref<null | string>(null);
let bodyStyleCache = "";
const refEl = ref(null);
let flag = ref<boolean>(false);
let status = ref<number>(0);
Expand Down Expand Up @@ -312,7 +312,7 @@ export default defineComponent({
});
const hasScrollbar = (el: HTMLElement) => {
if (el.scrollHeight > el.clientHeight) {
if (el.scrollHeight > window.innerHeight) {
return true;
}
return false;
Expand All @@ -327,16 +327,11 @@ export default defineComponent({
const isScrollBar = hasScrollbar(document.body);
if (isScrollBar) {
document.body.style.paddingRight = getScrollWidth() + "px";
bodyStyleCache.value = document.body.getAttribute("style");
document.body.classList.add("fox-lock-window");
}
document.body.style.overflow = "hidden";
} else {
if (bodyStyleCache.value) {
document.body.setAttribute("style", bodyStyleCache.value as string);
} else {
document.body.removeAttribute("style");
}
document.body.classList.remove("fox-lock-window");
document.body.style.paddingRight = "0px";
}
});
Expand Down Expand Up @@ -415,6 +410,7 @@ export default defineComponent({
background-color: rgba($color: #000000, $alpha: 0.4);
overflow: hidden;
border-radius: 4px;
backdrop-filter: saturate(50%) blur(4px);
&-canvas {
width: 100vw;
height: 100vh;
Expand All @@ -433,20 +429,26 @@ export default defineComponent({
}
&-close {
position: absolute;
top: 20px;
right: 20px;
top: -40px;
right: -40px;
user-select: none;
cursor: pointer;
background-color: #606266;
background-color: rgba($color: #000000, $alpha: 0.3);
border-radius: 50%;
font-size: 26px;
display: flex;
height: 30px;
width: 30px;
align-content: center;
align-items: center;
justify-content: center;
height: 80px;
width: 80px;
color: white;
overflow: hidden;
transition: background-color 0.15s;
& > svg {
position: absolute;
left: 15px;
bottom: 15px;
}
&:hover {
background-color: rgba($color: #000000, $alpha: 0.5);
}
}
&-operate {
&-item {
Expand Down Expand Up @@ -548,4 +550,7 @@ export default defineComponent({
fill: currentColor;
overflow: hidden;
}
.fox-lock-window {
overflow: hidden;
}
</style>
1 change: 1 addition & 0 deletions types/components/preview-image/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export declare const FoxPreviewImage: import("vue").DefineComponent<{
default: number;
};
}, {
refEl: import("vue").Ref<null>;
flag: import("vue").Ref<boolean>;
status: import("vue").Ref<number>;
active: import("vue").Ref<number>;
Expand Down
1 change: 1 addition & 0 deletions types/components/preview-image/src/index.vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ declare const _default: import("vue").DefineComponent<{
default: number;
};
}, {
refEl: import("vue").Ref<null>;
flag: import("vue").Ref<boolean>;
status: import("vue").Ref<number>;
active: import("vue").Ref<number>;
Expand Down

0 comments on commit 3398261

Please sign in to comment.