¶Ô±ÈÐÂÎļþ |
| | |
| | | <style scoped> |
| | | .standard { |
| | | padding: 20px 0; |
| | | } |
| | | |
| | | .left { |
| | | width: 270px; |
| | | height: calc(100% - 40px - 30px); |
| | | background-color: white; |
| | | padding: 15px; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="standard"> |
| | | <div class="left"> |
| | | <el-input placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" suffix-icon="el-icon-search" v-model="search" size="small" style="margin-bottom: 5px;"></el-input> |
| | | <el-tree class="filter-tree" :data="data" :props="defaultProps" default-expand-all |
| | | :filter-node-method="filterNode" ref="tree"> |
| | | </el-tree> |
| | | </div> |
| | | <div class="right"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | search: null, |
| | | data: [{ |
| | | id: 1, |
| | | label: 'ä¸çº§ 1', |
| | | children: [{ |
| | | id: 4, |
| | | label: 'äºçº§ 1-1', |
| | | children: [{ |
| | | id: 9, |
| | | label: 'ä¸çº§ 1-1-1' |
| | | }, { |
| | | id: 10, |
| | | label: 'ä¸çº§ 1-1-2' |
| | | }] |
| | | }] |
| | | }, { |
| | | id: 2, |
| | | label: 'ä¸çº§ 2', |
| | | children: [{ |
| | | id: 5, |
| | | label: 'äºçº§ 2-1' |
| | | }, { |
| | | id: 6, |
| | | label: 'äºçº§ 2-2' |
| | | }] |
| | | }, { |
| | | id: 3, |
| | | label: 'ä¸çº§ 3', |
| | | children: [{ |
| | | id: 7, |
| | | label: 'äºçº§ 3-1' |
| | | }, { |
| | | id: 8, |
| | | label: 'äºçº§ 3-2' |
| | | }] |
| | | }], |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'label' |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | |
| | | }, |
| | | methods: { |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | } |
| | | } |
| | | } |
| | | </script> |