Commit 9391114b authored by chenqikuai's avatar chenqikuai

设置公共参数

parent 731240ea
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
v-for="(menu, i) in menuList" v-for="(menu, i) in menuList"
:key="i" :key="i"
:class="{ :class="{
'bg-mGray5 ': currentRoute === i, 'bg-mGray5 ': current === i,
'!mt-20': i === 0, '!mt-20': i === 0,
}" }"
@click="selectPage && selectPage(i)" @click="selectCurrent && selectCurrent(i)"
> >
<div class="box-content" style="padding: 14px 0 5px 0;"> <div class="box-content" style="padding: 14px 0 5px 0;">
<i class="iconfont text-sm" v-html="menu.icon"></i> <i class="iconfont text-sm" v-html="menu.icon"></i>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<div <div
class="hidden absolute top-0 left-0 h-full bg-mBlue" class="hidden absolute top-0 left-0 h-full bg-mBlue"
:class="{ :class="{
'!block': currentRoute === i, '!block': current === i,
}" }"
style="width: 3px;" style="width: 3px;"
></div> ></div>
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
import { onBeforeMount } from "vue"; import { onBeforeMount } from "vue";
interface Props { interface Props {
currentRoute?: number; current?: number;
selectPage?: (i: number) => void; selectCurrent?: (i: number) => void;
menuList?: { menuList?: {
name: string; name: string;
icon: string; icon: string;
......
...@@ -4,6 +4,12 @@ import SideBar from "../components/src/SideBar"; ...@@ -4,6 +4,12 @@ import SideBar from "../components/src/SideBar";
export default { export default {
title: "SideBar", title: "SideBar",
component: SideBar, component: SideBar,
args: {
sideBarWidth: 64,
selectCurrent(i: number) {
console.log(i, "show i");
},
},
}; };
const Template: Story = (args) => ({ const Template: Story = (args) => ({
...@@ -35,10 +41,7 @@ Primary.args = { ...@@ -35,10 +41,7 @@ Primary.args = {
icon: "&#xe62a;", icon: "&#xe62a;",
}, },
], ],
currentRoute: 0, current: 0,
iconfontLink: "//at.alicdn.com/t/font_1321935_cdom05madx.css", iconfontLink: "//at.alicdn.com/t/font_1321935_cdom05madx.css",
selectPage(v: number) {
console.log(v, "show v");
},
sideBarWidth: 64, sideBarWidth: 64,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment