Skip to content

Commit

Permalink
[+] Add scroll button
Browse files Browse the repository at this point in the history
  • Loading branch information
LS-KR committed Nov 10, 2023
1 parent d3437e1 commit 665adbd
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 3 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {}

declare module 'vue' {
export interface GlobalComponents {
GoToTop: typeof import('./src/components/GoToTop.vue')['default']
JSONTable: typeof import('./src/components/JSONTable.vue')['default']
Navigation: typeof import('./src/components/Navigation.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
Expand Down
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<script setup lang="ts">
import Sidebar from "@/components/Sidebar.vue";
import GoToTop from "./components/GoToTop.vue";
import Navigation from "@/components/Navigation.vue";
</script>

<template>
<Sidebar />
<GoToTop />
</template>

<style lang="sass">
Expand Down
35 changes: 35 additions & 0 deletions src/components/GoToTop.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="gotoTop" v-on:click="onClick()">↑</div>
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";
export default class GoToTop extends Vue {
onClick(): void {
window.scroll(0, 0);
}
}
</script>

<style lang="sass">
.gotoTop
position: fixed
bottom: 40px
right: 40px
z-index: 50
user-select: none
background-color: #efeff5
min-width: 50px
min-height: 50px
border-style: solid
border-color: #D9DADB
border-radius: 25px
font-size: 29px
text-align: center
box-shadow: 4px 4px 4px rgba(44, 45, 47, 0.2)
.gotoTop:hover
border-color: #3052DD
box-shadow: 8px 8px 8px rgba(44, 45, 47, 0.6)
</style>
9 changes: 6 additions & 3 deletions src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export default class Navigation extends Vue {}
.nav
display: block
width: 100vw
position: fixed
width: calc(100vw - 300px)
height: 60px
background-color: #FEFEFE
right: 0px
top: 0px
background-color: #E0E1E2
.user
text-align: right
Expand All @@ -37,6 +40,6 @@ img
p
display: inline-block
font-size: xx-large
font-size: x-large
font-family: 'Consolas'
</style>
78 changes: 78 additions & 0 deletions src/json/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,83 @@
"description": "user2",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user3",
"description": "user3",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user4",
"description": "user4",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user5",
"description": "user5",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user6",
"description": "user6",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user7",
"description": "user7",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user8",
"description": "user8",
"button1": "编辑",
"button2": "删除"
},
{
"title": "user9",
"description": "user9",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userA",
"description": "userA",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userB",
"description": "userB",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userC",
"description": "userC",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userD",
"description": "userD",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userE",
"description": "userE",
"button1": "编辑",
"button2": "删除"
},
{
"title": "userF",
"description": "userF",
"button1": "编辑",
"button2": "删除"
}
]

0 comments on commit 665adbd

Please sign in to comment.