mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-12-23 08:46:39 +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 defaultExpanded = computed(() => {
|
||||
const path = getActive();
|
||||
const parentPath = path.substring(0, path.lastIndexOf('/'));
|
||||
return parentPath === '' ? [] : [parentPath];
|
||||
});
|
||||
|
||||
const sideNavCls = computed(() => {
|
||||
const { isCompact } = props;
|
||||
return [
|
||||
|
@ -44,6 +50,7 @@ const useComputed = (props) => {
|
|||
|
||||
return {
|
||||
active,
|
||||
defaultExpanded,
|
||||
collapsed,
|
||||
sideNavCls,
|
||||
menuCls,
|
||||
|
@ -130,6 +137,7 @@ export default defineComponent({
|
|||
class={this.menuCls}
|
||||
theme={this.theme}
|
||||
value={this.active}
|
||||
default-expanded={this.defaultExpanded}
|
||||
collapsed={this.collapsed}
|
||||
v-slots={{
|
||||
logo: () =>
|
||||
|
|
Loading…
Reference in New Issue
Block a user