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