@ektx/v-contextmenu
Advanced tools
Comparing version 0.2.6 to 0.2.7
18
main.js
@@ -12,6 +12,6 @@ | ||
menus () { | ||
return this.$store.state.contextmenu.data | ||
return this.$store.state.VContextmenu.data | ||
}, | ||
showMenu() { | ||
return this.$store.state.contextmenu.show | ||
return this.$store.state.VContextmenu.show | ||
} | ||
@@ -24,4 +24,4 @@ }, | ||
// 在 vuex 中如果有数据和鼠标事件的情况下我们格式化数据 | ||
if (this.$store.state.contextmenu.evt) | ||
this.show(val, this.$store.state.contextmenu.evt) | ||
if (this.$store.state.VContextmenu.evt) | ||
this.show(val, this.$store.state.VContextmenu.evt) | ||
} | ||
@@ -126,7 +126,7 @@ }, | ||
// 设置默认值 | ||
this.$set(this.$store.state, 'contextmenu', { | ||
show: true, | ||
data: {}, | ||
evt: null | ||
}) | ||
// this.$set(this.$store.state, 'contextmenu', { | ||
// show: true, | ||
// data: {}, | ||
// evt: null | ||
// }) | ||
}, | ||
@@ -133,0 +133,0 @@ created () { |
{ | ||
"name": "@ektx/v-contextmenu", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Vue 右键菜单功能", | ||
@@ -16,2 +16,2 @@ "author": "kings <530675800@qq.com>", | ||
} | ||
} | ||
} |
@@ -1,4 +0,1 @@ | ||
let store = {} | ||
export default { | ||
@@ -13,5 +10,2 @@ name: 'v-contextmenus-body', | ||
}, | ||
beforeCreate () { | ||
store = this.$store | ||
}, | ||
methods: { | ||
@@ -18,0 +12,0 @@ /* |
@@ -20,10 +20,6 @@ # VContextmenu | ||
```javascript | ||
import setContextmenu from '@ektx/v-contextmenus/store' | ||
import VContextmenu from '@ektx/v-contextmenu/store' | ||
const store = new Vuex.Store({ | ||
state: {}, | ||
// add this mutations | ||
mutations: { | ||
setContextmenu | ||
} | ||
modules: { VContextmenu } | ||
}) | ||
@@ -41,3 +37,3 @@ ``` | ||
<!-- 引用 HTML 结构 --> | ||
<VContextmenus></VContextmenus> | ||
<VContextmenus /> | ||
</main> | ||
@@ -101,3 +97,3 @@ </template> | ||
rightClick (evt) { | ||
store.commit('setContextmenu', { | ||
this.$store.commit('setContextmenu', { | ||
data: this.menu, evt | ||
@@ -104,0 +100,0 @@ }) |
22
store.js
@@ -1,7 +0,17 @@ | ||
export default function setContextmenu (state, data) { | ||
if (Object.keys(data).length > 1) { | ||
state.contextmenu = data | ||
} else { | ||
state.contextmenu.show = data.show | ||
export default { | ||
state: { | ||
show: true, | ||
data: {}, | ||
evt: null | ||
}, | ||
mutations: { | ||
setContextmenu (state, data) { | ||
if (Object.keys(data).length > 1) { | ||
Object.assign(state, data) | ||
} else { | ||
state.show = data.show | ||
} | ||
} | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11716
227
118