mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-12-23 08:26:32 +08:00
feat(sidenav): add default expanded (#200)
This commit is contained in:
parent
af235ed036
commit
1fa7740e92
|
@ -15,6 +15,12 @@ const useComputed = (props) => {
|
||||||
|
|
||||||
const active = computed(() => getActive());
|
const active = computed(() => getActive());
|
||||||
|
|
||||||
|
const defaultExpanded = computed(() => {
|
||||||
|
const path = getActive();
|
||||||
|
const parentPath = path.substring(0, path.lastIndexOf('/'));
|
||||||
|
return parentPath === '' ? [] : [parentPath];
|
||||||
|
});
|
||||||
|
|
||||||
const sideNavCls = computed(() => {
|
const sideNavCls = computed(() => {
|
||||||
const { isCompact } = props;
|
const { isCompact } = props;
|
||||||
return [
|
return [
|
||||||
|
@ -44,6 +50,7 @@ const useComputed = (props) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
active,
|
active,
|
||||||
|
defaultExpanded,
|
||||||
collapsed,
|
collapsed,
|
||||||
sideNavCls,
|
sideNavCls,
|
||||||
menuCls,
|
menuCls,
|
||||||
|
@ -130,6 +137,7 @@ export default defineComponent({
|
||||||
class={this.menuCls}
|
class={this.menuCls}
|
||||||
theme={this.theme}
|
theme={this.theme}
|
||||||
value={this.active}
|
value={this.active}
|
||||||
|
default-expanded={this.defaultExpanded}
|
||||||
collapsed={this.collapsed}
|
collapsed={this.collapsed}
|
||||||
v-slots={{
|
v-slots={{
|
||||||
logo: () =>
|
logo: () =>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user