ui-process-h5 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-process-h5",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "main":"./src/plugin/index.js",
6
6
  "scripts": {
@@ -9,6 +9,6 @@
9
9
  "lint": "vue-cli-service lint"
10
10
  },
11
11
  "dependencies": {
12
- "vue-demi": "^0.14.0"
12
+ "vue-demi": "latest"
13
13
  }
14
14
  }
package/src/index.ts ADDED
@@ -0,0 +1,23 @@
1
+ import Vue, { ref, onMounted, onUnmounted } from 'vue-demi'
2
+
3
+ export function useMouse() {
4
+ const x = ref(0)
5
+ const y = ref(0)
6
+
7
+ const update = (e: MouseEvent) => {
8
+ x.value = e.pageX
9
+ y.value = e.pageY
10
+ }
11
+
12
+ onMounted(() => {
13
+ window.addEventListener("mousemove", update)
14
+ })
15
+
16
+ onUnmounted(() => {
17
+ window.removeEventListener('mousemove', update)
18
+ })
19
+
20
+ return {
21
+ x, y
22
+ }
23
+ }
@@ -1,5 +0,0 @@
1
- let checkPlugin = (v) => {
2
- console.log("操作成功:::", v)
3
- }
4
-
5
- export default checkPlugin
@@ -1,23 +0,0 @@
1
- /**
2
- *
3
- *
4
- */
5
-
6
- import { isVue3 } from "vue-demi";
7
- const dire2 = {
8
- bind(el, binding) {
9
- el.addEventListener("click", () => {
10
- console.log("=====>dire2", binding);
11
- });
12
- },
13
- };
14
-
15
- const dire3 = {
16
- beforeMount(el, binding) {
17
- el.addEventListener("click", () => {
18
- console.log("=====>dire3", binding);
19
- });
20
- },
21
- };
22
-
23
- export default isVue3 ? dire3 : dire2;
@@ -1,23 +0,0 @@
1
- import { isVue3 } from "vue-demi";
2
- import dire from "./directive/index";
3
- import checkPlugin from "./commonfs/index";
4
-
5
- const ins2 = {
6
- install(Vue) {
7
- Vue.directive("process", dire);
8
- Vue.prototype.$process = (params = {}) => {
9
- checkPlugin(params);
10
- };
11
- },
12
- };
13
-
14
- const ins3 = {
15
- install(app) {
16
- app.directive("process", dire);
17
- app.config.globalProperties.$process = (params = {}) => {
18
- checkPlugin(params);
19
- };
20
- },
21
- };
22
-
23
- export default isVue3 ? ins3 : ins2;