navigation-bar
intro:
Navigation bar plugin
Reference
Method
setState
set state
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.setState({ color: "#ff00ff" });
getState
get current state
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.getState();
setColor
set color
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.setColor("#ff00ff");
getColor
get current color
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.getColor();
setStyle
set style, such as dark mode
ts
import { navigationBarPlugin, NAVIGATION_BAR_STYLE } from "@plaoc/plugins";
navigationBarPlugin.setStyle(NAVIGATION_BAR_STYLE.Dark);
getStyle
get current style
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.getStyle();
setOverlay
set overlay
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.setOverlay(true);
getOverlay
get overlay
ts
import { navigationBarPlugin } from "@plaoc/plugins";
navigationBarPlugin.getOverlay();
Parameter
NAVIGATION_BAR_STYLE
navigation bar style
ts
import { NAVIGATION_BAR_STYLE } from "@plaoc/plugins";
NAVIGATION_BAR_STYLE.Dark;
$NavigationBarWritableState
navigation bar state
ts
import { NAVIGATION_BAR_STYLE, type $NavigationBarWritableState } from "@plaoc/plugins";
const state: Partial<$NavigationBarWritableState> = {
color: "",
style: NAVIGATION_BAR_STYLE.Light,
overlay: true,
visible: true,
};
Usage Plugins
vue
<script setup lang="ts">
import { ref } from "vue";
import { navigationBarPlugin } from "@plaoc/plugins";
async function getState() {
const state = navigationBarPlugin.getState();
}
</script>
Usage WebComponent
vue
<script setup lang="ts">
import { ref } from "vue";
import { HTMLDwebNavigationBarElement } from "@plaoc/plugins";
const $navigationBarPlugin = ref<HTMLDwebNavigationBarElement>();
async function getState() {
const navigationBar = $navigationBarPlugin.value!;
const state = navigationBar.getState();
}
</script>
<template>
<dweb-navigation-bar ref="$navigationBarPlugin"></dweb-navigation-bar>
</template>