Skip to content

Commit

Permalink
feat: 增加滚动行为(支持后退保持之前的位置等)
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 17, 2024
1 parent e53afaf commit bcb48df
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
<meta id="theme__color" name="theme-color" content="#000" />
<link rel="manifest" href="/manifest.json" />
<style>
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
}
html {
width: 100%;
background: #f2f2f2;
}

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": "sub-store-front-end",
"version": "2.14.66",
"version": "2.14.67",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
display: flex;
flex-direction: column;
position: absolute;
height: 100%;
min-height: 100%;
width: 100%;
background: var(--background-color);
Expand Down
2 changes: 1 addition & 1 deletion src/components/PreviewPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
},
];
const surgeTips = () => {
Toast.text('"target=SurgeMac" - supports SSR external', {
Toast.text('"target=SurgeMac" - supports ShadowsocksR/External Proxy Program', {
title: 'Surge Tips',
duration: 0,
cover: true,
Expand Down
13 changes: 13 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ declare module 'vue-router' {

const history = createWebHistory();
const router = createRouter({
scrollBehavior(to, from, savedPosition) {
if (to.hash) {
return {
el: to.hash,
behavior: 'smooth',
}
}
if (savedPosition) {
return savedPosition
} else {
return { top: 0, left: 0 }
}
},
history,
routes: [
{
Expand Down

0 comments on commit bcb48df

Please sign in to comment.