status-bar
介绍:
状态栏插件
Reference
Method
setState
设置状态
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.setState({ color: "#ff00ff" });
getState
获取当前状态
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.getState();
setColor
设置颜色
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.setColor("#ff00ff");
getColor
获取当前颜色
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.getColor();
setStyle
设置模式,如:暗黑模式
ts
import { statusBarPlugin, STATUS_BAR_STYLE } from "@plaoc/plugins";
statusBarPlugin.setStyle(STATUS_BAR_STYLE.Dark);
getStyle
获取当前模式
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.getStyle();
setOverlay
设置覆盖
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.setOverlay(true);
getOverlay
获取覆盖状态
ts
import { statusBarPlugin } from "@plaoc/plugins";
statusBarPlugin.getOverlay();
Parameter
STATUS_BAR_STYLE
状态栏模式
ts
import { STATUS_BAR_STYLE } from "@plaoc/plugins";
STATUS_BAR_STYLE.Dark;
$StatusBarWritableState
状态栏状态值
ts
import { STATUS_BAR_STYLE, type $StatusBarWritableState } from "@plaoc/plugins";
const state: Partial<$StatusBarWritableState> = {
color: "",
style: STATUS_BAR_STYLE.Light,
overlay: true,
visible: true,
};
Usage Plugins
vue
<script setup lang="ts">
import { ref } from "vue";
import { statusBarPlugin } from "@plaoc/plugins";
async function getState() {
const state = statusBarPlugin.getState();
}
</script>
Usage WebComponent
vue
<script setup lang="ts">
import { ref } from "vue";
import { HTMLDwebStatusBarElement } from "@plaoc/plugins";
const $statusBarPlugin = ref<HTMLDwebStatusBarElement>();
async function getState() {
const statusBar = $statusBarPlugin.value!;
const state = statusBar.getState();
}
</script>
<template>
<dweb-status-bar ref="$statusBarPlugin"></dweb-status-bar>
</template>