EasyUI Forum

General Category => EasyUI for Vue => Topic started by: fengdie on August 16, 2018, 04:59:37 AM



Title: LayoutPanel how to auto resize
Post by: fengdie on August 16, 2018, 04:59:37 AM
折叠左侧菜单,布局无法自动伸缩。
toggle SideMenu state,LayoutPanel don't auto resize
Code:
<template>
  <Layout>
    <LayoutPanel region="north" :border="false" bodyCls="cywebos-header">
      <LinkButton @click="toggle">折叠</LinkButton>
    </LayoutPanel>
    <LayoutPanel :style="{width:width+'px'}" region="west" :border="false" bodyCls="cywebos-sidebar">
        <SideMenu
                :data="menus"
                :collapsed="collapsed"
                @selectionChange="selection=$event">
        </SideMenu>
    </LayoutPanel>
    <LayoutPanel region="center" :border="false" bodyCls="cywebos-body" style="height:100%">
      121221
    </LayoutPanel>
  </Layout>
</template>

<script>
export default {
  data() {
    return {
      width: 230,
      collapsed: false,
      selection: null,
      menus: [
        {
          text: "Item1",
          iconCls: "icon-sum",
          state: "open",
          children: [
            {
              text: "Option1"
            },
            {
              text: "Option2"
            },
            {
              text: "Option3",
              children: [
                {
                  text: "Option31"
                },
                {
                  text: "Option32"
                }
              ]
            }
          ]
        },
        {
          text: "Item2",
          iconCls: "icon-more",
          children: [
            {
              text: "Option4"
            },
            {
              text: "Option5"
            },
            {
              text: "Option6"
            }
          ]
        }
      ]
    };
  },
  methods: {
    toggle() {
      this.collapsed = !this.collapsed;
      this.width = this.collapsed ? 50 : 230;
    }
  }
};
</script>

<style>
.cywebos-header {
  color: #fff;
  height: 50px;
  line-height: 50px;
  background-color: #3c8dbc;
}
.cywebos-sidebar {
  background-color: #1a2226;
}
.cywebos-body {
  background: #ecf0f5;
}
</style>



Title: Re: LayoutPanel how to auto resize
Post by: jarry on August 16, 2018, 06:05:38 PM
Please look at this example https://www.jeasyui.com/demo-vue/main/index.php?plugin=Layout&theme=material-teal&dir=ltr&pitem=AppLayout&sort=asc