EasyUI Forum
May 13, 2024, 04:01:16 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to toggle 'panel' collapse or expand  (Read 4887 times)
fengdie
Jr. Member
**
Posts: 87


View Profile Email
« on: October 04, 2018, 09:39:19 AM »

How the parent component calls the subcomponent 'panel' to toggle the collapse or expand
(请问下,怎么在父组件设置panel状态。折叠或者展开)
Code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>EasyUI for Vue</title>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/color.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/vue.css">
    <script src="http://www.jeasyui.com/node_modules/vx-easyui/vue.min.js"></script>
    <script src="http://www.jeasyui.com/node_modules/vx-easyui/babel-polyfill.js"></script>
    <script src="http://www.jeasyui.com/node_modules/vx-easyui/vx-easyui-min.js"></script>
    <script src="http://www.jeasyui.com/node_modules/vx-easyui/babel.min.js"></script>
    <style type="text/css">
        body{
            padding: 20px;
        }
        h2{
            margin: 0 0 20px 0;
        }
        .mycontainer{
            min-width: 700px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script type="text/babel">
    var demobasic={
    template: `
  <div>
    <h2>Basic Panel</h2>
    <Panel ref="panelRef" title="Panel Title" :collapsible="true" :bodyStyle="{padding:'20px'}" style="height:200px">
      <p>Panel Content.</p>
    </Panel>
    <LinkButton @click="toggle">折叠切换</LinkButton>
  </div>
`,
            methods: {
                toggle() {
                    alert('toggle panel collapseState')
                }
            }
}
    var app = new Vue({
    el: '#app',
    template: `<demobasic class="mycontainer"></demobasic>`,
    components: {
    demobasic:demobasic   
            }
    })
    </script>
   
</body>
</html>

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


View Profile Email
« Reply #1 on: October 04, 2018, 04:25:32 PM »

Please set the 'collapsed' property to collapse or expand the panel.
Code:
<LinkButton @click="collapsed=!collapsed">Collapse</LinkButton>
<Panel :collapsed="collapsed" :animate="true">
  <p>panel</p>
</Panel>
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!