mirror of
https://github.com/tenrok/vue-context.git
synced 2026-05-17 04:19:36 +03:00
formatting
This commit is contained in:
@@ -47,18 +47,18 @@ import { VueContext } from 'vue-context';
|
||||
|
||||
new Vue({
|
||||
components: {
|
||||
VueContext
|
||||
VueContext
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Alert the text of the menu item that was clicked on.
|
||||
*
|
||||
* @param {string} text
|
||||
*/
|
||||
onClick (text) {
|
||||
/**
|
||||
* Alert the text of the menu item that was clicked on.
|
||||
*
|
||||
* @param {string} text
|
||||
*/
|
||||
onClick (text) {
|
||||
alert(`You clicked ${text}!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).$mount('#app');
|
||||
```
|
||||
@@ -124,22 +124,22 @@ import { VueContext } from 'vue-context';
|
||||
|
||||
new Vue({
|
||||
components: {
|
||||
VueContext
|
||||
VueContext
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Alert the text of the menu item that was clicked on.
|
||||
* Console log the data sent from the menu.
|
||||
*
|
||||
* @param {string} text
|
||||
* @param {object} data
|
||||
*/
|
||||
onClick (text, data) {
|
||||
/**
|
||||
* Alert the text of the menu item that was clicked on.
|
||||
* Console log the data sent from the menu.
|
||||
*
|
||||
* @param {string} text
|
||||
* @param {object} data
|
||||
*/
|
||||
onClick (text, data) {
|
||||
alert(`You clicked ${text}!`);
|
||||
console.log(data);
|
||||
// => { foo: 'bar' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}).$mount('#app');
|
||||
```
|
||||
|
||||
+18
-18
@@ -1,23 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Vue Context Test Page</title>
|
||||
</head>
|
||||
<body style="height:2000px;">
|
||||
<div id="app">
|
||||
<p @contextmenu.prevent="$refs.menu.open($event, { foo: 'bar' })">
|
||||
Right click on me
|
||||
</p>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Vue Context Test Page</title>
|
||||
</head>
|
||||
<body style="height:2000px;">
|
||||
<div id="app">
|
||||
<p @contextmenu.prevent="$refs.menu.open($event, { foo: 'bar' })">
|
||||
Right click on me
|
||||
</p>
|
||||
|
||||
<vue-context ref="menu" :close-on-scroll="close">
|
||||
<ul slot-scope="child">
|
||||
<li @click="onClick(child.data)">Option 1 {{ child.data && child.data.foo }}</li>
|
||||
<li>Option 2</li>
|
||||
</ul>
|
||||
</vue-context>
|
||||
</div>
|
||||
<vue-context ref="menu" :close-on-scroll="close">
|
||||
<ul slot-scope="child">
|
||||
<li @click="onClick(child.data)">Option 1 {{ child.data && child.data.foo }}</li>
|
||||
<li>Option 2</li>
|
||||
</ul>
|
||||
</vue-context>
|
||||
</div>
|
||||
|
||||
<script src="js/dist/index.js"></script>
|
||||
</body>
|
||||
<script src="js/dist/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+11
-11
@@ -2,17 +2,17 @@ import Vue from 'vue';
|
||||
import { VueContext } from '../../../dist/vue-context';
|
||||
|
||||
new Vue({
|
||||
components: {
|
||||
VueContext
|
||||
},
|
||||
components: {
|
||||
VueContext
|
||||
},
|
||||
|
||||
data: {
|
||||
close: true
|
||||
},
|
||||
data: {
|
||||
close: true
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick (data) {
|
||||
console.log(data);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClick (data) {
|
||||
console.log(data);
|
||||
},
|
||||
},
|
||||
}).$mount('#app');
|
||||
Reference in New Issue
Block a user