Fix: fix the issue that speed dial auto-adaptation theme does not work and is overwritten (#130)

This commit is contained in:
Jacob Lee 2022-06-24 22:15:06 +08:00 committed by GitHub
parent 305ae480bc
commit 013b2173fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 44 deletions

View File

@ -4,7 +4,7 @@
<v-main> <v-main>
<router-view></router-view> <router-view></router-view>
</v-main> </v-main>
<BottomNav></BottomNav> <BottomNav ref="bottomNavBar"></BottomNav>
<v-snackbar :value="successMessage" app bottom color="success" elevation="20"> <v-snackbar :value="successMessage" app bottom color="success" elevation="20">
{{ successMessage }} {{ successMessage }}
</v-snackbar> </v-snackbar>
@ -66,6 +66,12 @@ export default {
} }
}, },
mounted (){
const bottomNavBar = this.$refs.bottomNavBar.$el;
const height = bottomNavBar.offsetHeight || bottomNavBar.clientHeight;
this.$store.commit("SET_BOTTOM_NAVBAR_HEIGHT", height);
},
computed: { computed: {
successMessage() { successMessage() {
return this.$store.state.successMessage; return this.$store.state.successMessage;
@ -104,4 +110,4 @@ export default {
<style lang="scss"> <style lang="scss">
@import "./assets/css/app"; @import "./assets/css/app";
@import "./assets/css/general.css"; @import "./assets/css/general.css";
</style> </style>

View File

@ -1,23 +1,19 @@
<template> <template>
<div class="float-menu-switch-wrapper" ref = "floatMenuSwitch">
<v-speed-dial <v-speed-dial
class="float-menu-switch" v-model="fab"
v-model="fab" :direction="direction"
:top="top" :transition="transition"
:bottom="bottom"
:right="right"
:left="left"
:direction="direction"
:open-on-hover="hover"
:transition="transition"
> >
<template v-slot:activator> <template v-slot:activator>
<v-btn v-model="fab" color="primary" dark fab> <v-btn v-model="fab" color="primary" fab>
<v-icon v-if="fab"> mdi-close</v-icon> <v-icon v-if="fab"> mdi-close</v-icon>
<v-icon v-else> mdi-gesture-double-tap</v-icon> <v-icon v-else> mdi-gesture-double-tap</v-icon>
</v-btn> </v-btn>
</template> </template>
<slot></slot> <slot></slot>
</v-speed-dial> </v-speed-dial>
</div>
</template> </template>
<script> <script>
export default { export default {
@ -29,38 +25,38 @@ export default {
fling: false, fling: false,
hover: false, hover: false,
tabs: null, tabs: null,
top: false,
right: true,
bottom: true,
left: false,
transition: "scale-transition", transition: "scale-transition",
}; };
}, },
watch: {
top(val) { updated (){
this.bottom = !val; const floatMenuSwitch = this.$refs.floatMenuSwitch;
}, console.log(floatMenuSwitch);
right(val) { floatMenuSwitch.style.bottom = 2*this.bottomNavBarHeight + "px";
this.left = !val; },
},
bottom(val) { computed : {
this.top = !val; bottomNavBarHeight (){
}, return this.$store.state.bottomNavBarHeight;
left(val) {
this.right = !val;
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.float-menu-switch { .float-menu-switch-wrapper {
position: fixed; position : fixed;
bottom: 80px; right: 16px;;
right: 20px; z-index : 99;
> .v-btn {
width: 40px; .v-speed-dial > button.v-btn.v-btn--round {
height: 40px; margin-right : 0;
} width : 40px;
height : 40px;
}
::v-deep .v-speed-dial__list button.theme--light.v-btn {
margin-right : 0;
}
} }
/* This is for documentation purposes and will not be needed in your application */ /* This is for documentation purposes and will not be needed in your application */

View File

@ -10,6 +10,8 @@ const store = new Vuex.Store({
clipboard: "", clipboard: "",
isLoading: false, isLoading: false,
bottomNavBarHeight: 0,
successMessage: "", successMessage: "",
errorMessage: "", errorMessage: "",
snackbarTimer: "", snackbarTimer: "",
@ -30,6 +32,10 @@ const store = new Vuex.Store({
state.title = title; state.title = title;
}, },
SET_BOTTOM_NAVBAR_HEIGHT (state, height){
state.bottomNavBarHeight = height;
},
SET_LOADING(state, loading) { SET_LOADING(state, loading) {
state.isLoading = loading; state.isLoading = loading;
}, },
@ -127,4 +133,4 @@ const store = new Vuex.Store({
getters: {} getters: {}
}) })
export default store; export default store;

View File

@ -1,10 +1,10 @@
<template> <template>
<v-container> <v-container>
<FloatMenu> <FloatMenu class="floatActionBtn">
<v-btn fab dark small color="#ffffff" @click.stop="dialog = true"> <v-btn fab small @click.stop="dialog = true">
<v-icon color="purple lighten-1">mdi-plus-circle</v-icon> <v-icon color="purple lighten-1">mdi-plus-circle</v-icon>
</v-btn> </v-btn>
<v-btn fab dark small color="#ffffff" @click="save"> <v-btn fab small @click="save">
<v-icon color="teal lighten-1">mdi-content-save</v-icon> <v-icon color="teal lighten-1">mdi-content-save</v-icon>
</v-btn> </v-btn>
</FloatMenu> </FloatMenu>
@ -161,15 +161,15 @@
</v-form> </v-form>
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn text small color="#707277" @click = "save" > <v-btn text small @click = "save" class="fixedActionBtn">
<v-icon>mdi-content-save</v-icon> <v-icon>mdi-content-save</v-icon>
保存 保存
</v-btn> </v-btn>
<v-btn text small color = "#707277" @click.stop = "showShareDialog = true"> <v-btn text small @click.stop = "showShareDialog = true" class = "fixedActionBtn">
<v-icon>mdi-file-import</v-icon> <v-icon>mdi-file-import</v-icon>
导入 导入
</v-btn> </v-btn>
<v-btn text small color = "#707277" @click = "share"> <v-btn text small @click = "share" class = "fixedActionBtn">
<v-icon>mdi-share-circle</v-icon> <v-icon>mdi-share-circle</v-icon>
分享 分享
</v-btn> </v-btn>
@ -374,6 +374,7 @@ const AVAILABLE_PROCESSORS = {
export default { export default {
props: { props: {
isCollection: { isCollection: {
type: Boolean, type: Boolean,
default() { default() {
@ -735,8 +736,17 @@ function uuidv4() {
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.invert { .invert {
filter: invert(100%); filter: invert(100%);
} }
.fixedActionBtn{
&.theme--dark{
color: #ffffffcc;
}
&.theme--light {
color : #00000099;
}
}
</style> </style>