darkmode
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<v-tooltip :text="tooltip" location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn v-bind="props" :color="isCurrent?'primary':undefined" variant="text"
|
||||
:icon="icon" @click="()=>nav(route)"/>
|
||||
:icon="icon" @click="click"/>
|
||||
</template>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
@@ -12,9 +12,25 @@ import {computed} from "vue";
|
||||
import {useRoute} from "vue-router";
|
||||
import {nav} from "/src/misc.js"
|
||||
|
||||
const props = defineProps(['icon', 'route', 'tooltip'])
|
||||
const props = defineProps(['icon', 'route', 'tooltip', 'href', 'target'])
|
||||
const router = useRoute();
|
||||
const isCurrent = computed(() => router.name === props.route)
|
||||
|
||||
function click() {
|
||||
if (!props.href && !props.route)
|
||||
console.warn('must set href or route in toolbar-button')
|
||||
else if (props.href && props.route)
|
||||
console.warn('cannot set both rout and href in toolbar-button')
|
||||
else if (props.href) {
|
||||
if (props.target)
|
||||
window.open(props.href, props.target)
|
||||
else
|
||||
window.location.href = props.href
|
||||
|
||||
}
|
||||
else
|
||||
nav(props.route)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user