From 34525fe578eacd05f9f9d0e73eec8b1c6e8a650b Mon Sep 17 00:00:00 2001 From: Randall Wilk Date: Thu, 17 Aug 2017 22:03:08 -0500 Subject: [PATCH] Add styles to menu, fix issue with menu positioning, update package.json. --- index.vue | 64 ++++++++++++++++++++++++++++++++++++++++++++-------- package.json | 23 +++++++++++++++++-- 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/index.vue b/index.vue index 80b10ea..bf46345 100644 --- a/index.vue +++ b/index.vue @@ -8,7 +8,7 @@ @click="close" @contextmenu.capture.prevent > - + @@ -18,10 +18,10 @@ export default { data() { return { - show: false, top: null, left: null, - userData: null + userData: null, + show: false }; }, computed: { @@ -39,10 +39,10 @@ * Close the menu. */ close() { - this.show = false; this.top = null; this.left = null; this.userData = null; + this.show = false; }, /** @@ -55,12 +55,13 @@ this.userData = userData; let top = event.clientY, - left = event.pageX; + left = event.clientX; + + this.show = true; Vue.nextTick(() => { - this.$el.focus(); - this.setMenu(top, left); - this.show = true; + this.setMenu(top, left); + this.$el.focus(); }); }, @@ -87,4 +88,49 @@ } } } - \ No newline at end of file + + + \ No newline at end of file diff --git a/package.json b/package.json index 6852029..c78521f 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,14 @@ { "name": "vue-context", "version": "1.0.0", - "description": "A simple vue context menu.", + "description": "A simple vue context menu component.", "main": "index.vue", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "dev": "npm run development", + "development": "cross-env NODE_ENV=development webpack --progress", + "watch": "npm run development -- --watch", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production webpack --progress" }, "keywords": [ "vue", @@ -16,5 +20,20 @@ "license": "MIT", "dependencies": { "vue": "^2.4.2" + }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-loader": "^7.1.1", + "babel-preset-es2015": "^6.24.1", + "cross-env": "^5.0.5", + "css-loader": "^0.28.5", + "extract-text-webpack-plugin": "^3.0.0", + "node-sass": "^4.5.3", + "sass-loader": "^6.0.6", + "style-loader": "^0.18.2", + "vue-loader": "^13.0.4", + "vue-template-compiler": "^2.4.2", + "webpack": "^3.5.5" } }