-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XBT1
committed
Nov 4, 2017
1 parent
3dde06b
commit f43eb55
Showing
16 changed files
with
454 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<div class="example"> | ||
<v-contextmenu ref="contextmenu" event-type="click"> | ||
<v-contextmenu-item @click="handleClick">菜单1</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单2</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单3</v-contextmenu-item> | ||
</v-contextmenu> | ||
|
||
<v-contextmenu ref="dbContextmenu" event-type="dblclick"> | ||
<v-contextmenu-item @click="handleClick">菜单1</v-contextmenu-item> | ||
<v-contextmenu-item divider></v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单2</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单3</v-contextmenu-item> | ||
</v-contextmenu> | ||
|
||
<!-- <v-contextmenu ref="touchContextmenu" event-type="touchstart"> | ||
<v-contextmenu-item>菜单1</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单2</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单3</v-contextmenu-item> | ||
</v-contextmenu> --> | ||
|
||
<div class="box" v-contextmenu:contextmenu> | ||
左键点击此区域 | ||
</div> | ||
|
||
<div class="box" v-contextmenu:dbContextmenu> | ||
左键双击此区域 | ||
</div> | ||
|
||
<!-- <div class="box" v-contextmenu:touchContextmenu> | ||
触摸此区域 | ||
</div> --> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'CustomerEvent', | ||
methods: { | ||
handleClick (event, vm) { | ||
alert(`「${vm.$slots.default[0].text}」被点击啦!`) | ||
}, | ||
handleShow () { | ||
console.log('show') | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.box { | ||
width: 100%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<div class="example"> | ||
<div class="buttons"> | ||
<button type="button" @click="handleShow">显示</button> | ||
<button type="button" @click="handleHide">隐藏</button> | ||
</div> | ||
<div class="box" ref="box"> | ||
展示区域 | ||
|
||
<v-contextmenu ref="contextmenu"> | ||
<v-contextmenu-item>菜单1</v-contextmenu-item> | ||
<v-contextmenu-item divider></v-contextmenu-item> | ||
<v-contextmenu-item>菜单2</v-contextmenu-item> | ||
<v-contextmenu-item>菜单3</v-contextmenu-item> | ||
</v-contextmenu> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'CustomerShow', | ||
methods: { | ||
handleShow () { | ||
const postition = { | ||
top: Math.random() * this.$refs.box.clientHeight, | ||
left: Math.random() * this.$refs.box.clientWidth, | ||
} | ||
this.$refs.contextmenu.show(postition) | ||
}, | ||
handleHide() { | ||
this.$refs.contextmenu.hide() | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.buttons { | ||
padding: 5px 10px; | ||
background-color: #f2f2f2; | ||
} | ||
.box { | ||
position: relative; | ||
width: 100%; | ||
height: 120px; | ||
line-height: 120px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template> | ||
<div class="example"> | ||
<v-contextmenu ref="contextmenu"> | ||
<v-contextmenu-item @click="handleClick">菜单1-1</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单1-2</v-contextmenu-item> | ||
|
||
<v-contextmenu-item divider></v-contextmenu-item> | ||
|
||
<v-contextmenu-item @click="handleClick">菜单2-1</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单2-2</v-contextmenu-item> | ||
|
||
<v-contextmenu-item divider></v-contextmenu-item> | ||
|
||
<v-contextmenu-item @click="handleClick">菜单3-1</v-contextmenu-item> | ||
</v-contextmenu> | ||
|
||
<div class="box" v-contextmenu:contextmenu> | ||
右键点击此区域 | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Divider', | ||
methods: { | ||
handleClick (event, vm) { | ||
console.log(event, vm) | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.box { | ||
width: 100%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<div class="example"> | ||
<v-contextmenu ref="contextmenu"> | ||
<v-contextmenu-item @click="handleClick">菜单1</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单2</v-contextmenu-item> | ||
<v-contextmenu-item @click="handleClick">菜单3</v-contextmenu-item> | ||
</v-contextmenu> | ||
|
||
<div class="box" v-contextmenu:contextmenu> | ||
右键点击此区域 | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Simple', | ||
methods: { | ||
handleClick (event, vm) { | ||
alert(`「${vm.$slots.default[0].text}」被点击啦!`) | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.box { | ||
width: 100%; | ||
} | ||
</style> |
Oops, something went wrong.