@morebrick/utils
v1.0.1
Published
brick utils
Downloads
14
Maintainers
Readme
📦 安装
npm install @morebrick/utils
or
pnpm add @morebrick/utils
🦄 用法
utils
import { randomColor } from "@morebrick/utils";
console.log(randomColor({ type: "hex", num: 6 }));
hooks
<script setup lang="ts">
import { ref, type Ref } from "vue";
import { useECharts } from "@morebrick/utils";
const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(
chartRef as Ref<HTMLDivElement>,
ref("light")
);
setOptions(
{
tooltip: {
trigger: "item"
},
legend: {
orient: "vertical",
right: 0
},
series: [
{
name: "xxx",
type: "pie",
radius: "60%",
center: ["40%", "50%"],
data: [
{ value: 1, name: "watchers" },
{ value: 2, name: "star" },
{ value: 3, name: "forks" },
{ value: 4, name: "open_issues" }
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)"
}
}
}
]
},
{
name: "click",
callback: params => {
console.log("click", params);
}
},
{
name: "contextmenu",
callback: params => {
console.log("contextmenu", params);
}
},
// 点击空白处
{
type: "zrender",
name: "click",
callback: params => {
console.log("点击空白处", params);
}
}
);
</script>
<template>
<div ref="chartRef" style="width: 100%; height: 100%" />
</template>