Skip to content

Commit

Permalink
feat: 更新1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shiouhoo committed May 30, 2024
1 parent 13fc6a8 commit b52e5fa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

## 1.3.1(2024-5-11)
## 1.3.1(2024-5-30)

- nginxConfig(feat): 更新停止nginx
- useTabScroll(fix): 监听tabActive变化函数,定时器没有清除问题
Expand Down
11 changes: 8 additions & 3 deletions docs/utils/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ outline: [2,3]

```ts
async function downloadFile(
res: ArrayBuffer | Blob | Promise<ArrayBuffer | Blob>,
res: string | ArrayBuffer | Blob | Promise<ArrayBuffer | Blob>,
fileName: string
){
let e: Blob;
if(res instanceof Promise) {
res.then(()=>{
if(typeof res === 'string') {
axios.get(res, {responseType: 'blob'}).then((res)=>{
downloadFile(res, fileName);
});
return;
}else if(res instanceof Promise) {
res.then((res)=>{
downloadFile(res, fileName);
});
return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hooui",
"version": "1.3.0",
"version": "1.3.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useTabScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getDom(target: TabValue): HTMLElement {
}
// 获取元素距离滚动容器顶部的距离
function getOffsetTop(element: HTMLElement, parent: HTMLElement | Window) {
return parent instanceof Window ? element.getBoundingClientRect().top - document.body.getBoundingClientRect().top : element.getBoundingClientRect().top - parent.getBoundingClientRect().top;
return parent instanceof Window ? element.getBoundingClientRect().top - document.body.getBoundingClientRect().top : element.getBoundingClientRect().top - parent.getBoundingClientRect().top + parent.scrollTop;
}

function debounce(func: ()=>void, wait:number) {
Expand All @@ -41,7 +41,8 @@ function debounce(func: ()=>void, wait:number) {

export function useTabScroll(
target: TabScroll[],
scrollContainer: Ref<HTMLElement | null> | string | HTMLElement | Window = window, targetTop = 20,
scrollContainer: Ref<HTMLElement | null> | string | HTMLElement | Window = window,
targetTop = 20,
trigger?: Ref<Boolean>
) {
const tabActive = ref<string | number>();
Expand Down

0 comments on commit b52e5fa

Please sign in to comment.