EasyUI Forum
May 03, 2024, 06:49:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: LayoutPanel how to auto resize  (Read 5980 times)
fengdie
Jr. Member
**
Posts: 87


View Profile Email
« 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>

Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!