mirror of https://github.com/ElemeFE/element
				
				
				
			
							parent
							
								
									1ad30c3f19
								
							
						
					
					
						commit
						6dd09cc11d
					
				|  | @ -156,6 +156,11 @@ Vertical NavMenu with sub-menus. | |||
| | open  | callback function when sub-menu expands | index: index of expanded sub-menu, indexPath: index path of expanded sub-menu | | ||||
| | close  | callback function when sub-menu collapses | index: index of collapsed sub-menu, indexPath: index path of collapsed sub-menu | | ||||
| 
 | ||||
| ### Menu-Item Events | ||||
| | Event Name | Description | Parameters | | ||||
| |---------- |-------- |---------- | | ||||
| | click  | callback function when menu-item is clicked | el: menu-item instance  | | ||||
| 
 | ||||
| ### SubMenu Attribute | ||||
| | Attribute      | Description          | Type      | Accepted Values       | Default  | | ||||
| |---------- |-------- |---------- |-------------  |-------- | | ||||
|  |  | |||
|  | @ -42,6 +42,7 @@ | |||
|     methods: { | ||||
|       handleClick() { | ||||
|         this.dispatch('ElMenu', 'item-click', this); | ||||
|         this.$emit('click', this); | ||||
|       } | ||||
|     }, | ||||
|     created() { | ||||
|  |  | |||
|  | @ -27,6 +27,35 @@ describe('Menu', () => { | |||
|       }); | ||||
|     }); | ||||
|   }); | ||||
|   it('menu-item click', done => { | ||||
|     vm = createVue({ | ||||
|       template: ` | ||||
|         <el-menu> | ||||
|           <el-menu-item @click="onMenuItemClick" index="1" ref="item1">处理中心</el-menu-item> | ||||
|           <el-menu-item index="2" ref="item2">订单管理</el-menu-item> | ||||
|         </el-menu> | ||||
|       `, | ||||
|       methods: { | ||||
|         onMenuItemClick(el) { | ||||
|           expect(el).to.be.equal(vm.$refs.item1); | ||||
|           this.clicksCount = this.clicksCount + 1; | ||||
|         } | ||||
|       }, | ||||
|       data() { | ||||
|         return { | ||||
|           clicksCount: 0 | ||||
|         }; | ||||
|       } | ||||
|     }, true); | ||||
|     var item1 = vm.$refs.item1; | ||||
|     item1.$el.click(); | ||||
| 
 | ||||
|     vm.$nextTick(_ => { | ||||
|       expect(vm.clicksCount).to.be.equal(1); | ||||
|       done(); | ||||
|     }); | ||||
| 
 | ||||
|   }); | ||||
|   describe('default active', () => { | ||||
|     it('normal active', done => { | ||||
|       vm = createVue({ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Vinicius Reis
						Vinicius Reis