Skip to content

Commit 1d65da9

Browse files
committed
Merge branch 'master' of github.com:InhiblabCore/vue-hooks-plus
2 parents c9da0d5 + 6503d87 commit 1d65da9

File tree

80 files changed

+476
-690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+476
-690
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
"@ruabick/vite-plugin-gen-temp": "^0.2.8",
2727
"@types/fs-extra": "^9.0.13",
2828
"@types/jest": "^29.0.0",
29-
"@types/js-cookie": "^3.0.1",
3029
"@types/lodash": "^4.14.178",
3130
"@types/marked": "^4.0.3",
3231
"@types/node": "^17.0.21",
3332
"@types/qs": "^6.9.7",
3433
"@vitejs/plugin-vue": "^2.3.1",
3534
"@vue-hooks-plus/md-demo-plugins": "^1.0.0",
3635
"@vue-hooks-plus/vitepress": "1.0.1",
37-
"@vue-hooks-plus/vitepress-demo-block": "^1.2.4",
36+
"@vue-hooks-plus/vitepress-demo-block": "^1.2.7",
3837
"@vue/test-utils": "^2.1.0",
3938
"eslint": "^8.20.0",
4039
"eslint-config-prettier": "^8.5.0",

packages/hooks/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-hooks-plus",
3-
"version": "1.4.1",
3+
"version": "1.4.2-beta",
44
"description": "Vue hooks library",
55
"files": [
66
"dist",
@@ -37,14 +37,14 @@
3737
},
3838
"dependencies": {
3939
"intersection-observer": "^0.12.2",
40-
"js-cookie": "^2.x.x",
40+
"js-cookie": "^3.0.1",
4141
"lodash": "^4.17.21",
4242
"marked": "^4.0.17",
4343
"qs": "^6.11.0",
4444
"query-string": "^7.1.1",
45-
"screenfull": "^5.0.0"
45+
"screenfull": "^5.0.0",
46+
"@types/js-cookie": "^3.0.1"
4647
},
47-
4848
"repository": "https://github.com/InhiblabCore/vue-hooks-plus/",
4949
"homepage": "https://github.com/InhiblabCore/vue-hooks-plus/",
5050
"author": "NelsonYong",

packages/hooks/scripts/build.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export const buildConfig: UserConfig = {
2727
output: { globals: { vue: 'Vue' } },
2828
},
2929
lib: {
30-
formats: ['es', 'cjs'],
30+
formats: ['es', 'cjs', 'iife'],
3131
entry: path.resolve(__dirname, '..', 'src/index.ts'),
32-
name: 'vue-hooks-plus',
32+
name: 'VueHooks_Plus',
3333
fileName: format => `js/index.${format}.js`,
3434
},
3535
},
@@ -55,8 +55,8 @@ export const buildFullTypesConfig: UserConfig = {
5555
minify: true,
5656
lib: {
5757
entry: path.resolve(__dirname, '..', 'src/index.ts'),
58-
name: 'vue-hooks-plus',
59-
formats: ['es', 'cjs'],
58+
name: 'VueHooks_Plus',
59+
formats: ['es', 'cjs', 'iife'],
6060
fileName: format => {
6161
return `js/index.${format}.js`
6262
},

packages/hooks/src/useAsyncOrder/demo/demo.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,3 @@
7171
},
7272
})
7373
</script>
74-
75-
<style scoped lang="less"></style>

packages/hooks/src/useBoolean/demo/demo.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<br>
55
<div>
66
<p>
7-
<vhp-button style="margin-left: 16px" @click="() => set(!flag)">set</vhp-button>
8-
<vhp-button style="margin-left: 16px" @click="() => setTrue()">setTrue</vhp-button>
9-
<vhp-button style="margin-left: 16px" @click="() => setFalse()">setFalse</vhp-button>
7+
<vhp-button @click="() => set(!flag)">set</vhp-button>
8+
<vhp-button style="margin-left: 8px" @click="() => setTrue()">setTrue</vhp-button>
9+
<vhp-button style="margin-left: 8px" @click="() => setFalse()">setFalse</vhp-button>
1010
</p>
1111
</div>
1212
</div>

packages/hooks/src/useCounter/demo/demo.vue

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
<vhp-button type="vhp-button" @click="inc()">
66
inc()
77
</vhp-button>
8-
<vhp-button type="vhp-button" @click="dec()">
8+
<vhp-button type="vhp-button" @click="dec()" style="margin-right: 8px">
99
dec()
1010
</vhp-button>
11-
<vhp-button type="vhp-button" @click="set(3)">
11+
<vhp-button type="vhp-button" @click="set(3)" style="margin-right: 8px">
1212
set(3)
1313
</vhp-button>
14-
<vhp-button type="vhp-button" @click="reset()">
14+
<vhp-button type="vhp-button" @click="reset()" style="margin-right: 8px">
1515
reset()
1616
</vhp-button>
1717
</div>
@@ -22,11 +22,3 @@
2222
import { useCounter } from 'vue-hooks-plus'
2323
const [current, { inc, dec, set, reset }] = useCounter(20, { min: 1, max: 10 })
2424
</script>
25-
26-
<style scoped lang="less">
27-
.contain {
28-
& > vhp-button {
29-
margin-right: 8px;
30-
}
31-
}
32-
</style>

packages/hooks/src/useDarkMode/demo/Test.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@
3131
},
3232
}
3333
</script>
34-
35-
<style scoped lang="less"></style>

packages/hooks/src/useDarkMode/demo/demo.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@
3131
},
3232
}
3333
</script>
34-
35-
<style scoped lang="less"></style>
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<template>
2-
<div>
3-
<input type="text" placeholder="输入" v-model="valueRef" />
4-
<p>500ms后变化:{{ debouncedValue }}</p>
5-
</div>
2+
<div>
3+
<input type="text" placeholder="输入" v-model="valueRef">
4+
<p>500ms后变化:{{ debouncedValue }}</p>
5+
</div>
66
</template>
77

88
<script lang="ts" setup>
9-
import { ref } from 'vue'
9+
import { ref } from 'vue'
1010
11-
import { useDebounce } from 'vue-hooks-plus'
12-
const valueRef = ref('')
11+
import { useDebounce } from 'vue-hooks-plus'
12+
const valueRef = ref('')
1313
14-
const debouncedValue = useDebounce(valueRef, { wait: 500 })
14+
const debouncedValue = useDebounce(valueRef, { wait: 500 })
1515
</script>
16-
<style scoped lang="less"></style>

packages/hooks/src/useDebounceFn/demo/demo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
},
2020
)
2121
</script>
22-
<style scoped lang="less"></style>
Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
<template>
2-
<div
3-
ref="dragRef"
4-
style="border:1px solid #e8e8e8; padding: 16px; width: 100px; text-align: center; margin-right: 16px;"
5-
>
6-
{{ dragging ? 'dragging' : `box-${data}` }}
7-
</div>
2+
<div
3+
ref="dragRef"
4+
style="border:1px solid #e8e8e8; padding: 16px; width: 100px; text-align: center; margin-right: 16px;"
5+
>
6+
{{ dragging ? 'dragging' : `box-${data}` }}
7+
</div>
88
</template>
99

1010
<script lang="ts" setup>
11-
import { ref } from 'vue'
11+
import { ref } from 'vue'
1212
13-
import { useDrag, useBoolean } from 'vue-hooks-plus'
13+
import { useDrag, useBoolean } from 'vue-hooks-plus'
1414
15-
const props = defineProps<{
16-
data?: string
17-
}>()
18-
const [dragging, { set: setDragging }] = useBoolean(false)
19-
const dragRef = ref(null)
15+
const props = defineProps<{
16+
data?: string
17+
}>()
18+
const [dragging, { set: setDragging }] = useBoolean(false)
19+
const dragRef = ref(null)
2020
21-
useDrag(props.data, dragRef, {
22-
onDragStart: () => {
23-
setDragging(true)
24-
},
25-
onDragEnd: () => {
26-
setDragging(false)
27-
},
28-
})
21+
useDrag(props.data, dragRef, {
22+
onDragStart: () => {
23+
setDragging(true)
24+
},
25+
onDragEnd: () => {
26+
setDragging(false)
27+
},
28+
})
2929
</script>
30-
31-
<style scoped lang="less"></style>

packages/hooks/src/useDrop/demo/demo.vue

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,42 @@ useDrag(props.data, dragRef, {
3232
-->
3333

3434
<template>
35-
<div>
36-
<div
37-
ref="dropRef"
38-
style=" border: 1px dashed #e8e8e8 ; padding: 16px; text-align: center;max-height: 400px;overflow-y: scroll;"
39-
>
40-
{{ isHovering ? 'release here' : 'drop here' }}
35+
<div>
36+
<div
37+
ref="dropRef"
38+
style=" border: 1px dashed #e8e8e8 ; padding: 16px; text-align: center;max-height: 400px;overflow-y: scroll;"
39+
>
40+
{{ isHovering ? 'release here' : 'drop here' }}
4141

42-
<p v-for="(item, index) in list" :key="index">{{ item }}</p>
43-
</div>
44-
<div style=" margin-top: 8px">
45-
<drag-demo
46-
v-for="item in [
47-
'1',
48-
'2',
49-
'3',
50-
'4',
51-
'5',
52-
'6',
53-
'7',
54-
'8',
55-
'9',
56-
'10',
57-
'11',
58-
'12',
59-
'13',
60-
]"
61-
:key="item"
62-
:data="item"
63-
/>
64-
</div>
65-
</div>
42+
<p v-for="(item, index) in list" :key="index">{{ item }}</p>
43+
</div>
44+
<div style=" margin-top: 8px">
45+
<drag-demo
46+
v-for="item in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']"
47+
:key="item"
48+
:data="item"
49+
/>
50+
</div>
51+
</div>
6652
</template>
6753

6854
<script lang="ts" setup>
69-
import { ref } from 'vue'
55+
import { ref } from 'vue'
7056
71-
import { useBoolean, useDrop } from 'vue-hooks-plus'
72-
import DragDemo from './DragDemo.vue'
57+
import { useBoolean, useDrop } from 'vue-hooks-plus'
58+
import DragDemo from './DragDemo.vue'
7359
74-
const dropRef = ref(null)
75-
const list = ref([])
76-
const [isHovering, { set: setIsHovering }] = useBoolean(false)
60+
const dropRef = ref(null)
61+
const list = ref([])
62+
const [isHovering, { set: setIsHovering }] = useBoolean(false)
7763
78-
useDrop(dropRef, {
79-
onDom: (content: string, e) => {
80-
// @ts-ignore
81-
list.value.push(`custom: ${content} dropped`)
82-
setIsHovering(false)
83-
},
84-
onDragEnter: () => setIsHovering(true),
85-
onDragLeave: () => setIsHovering(false),
86-
})
64+
useDrop(dropRef, {
65+
onDom: (content: string, e) => {
66+
// @ts-ignore
67+
list.value.push(`custom: ${content} dropped`)
68+
setIsHovering(false)
69+
},
70+
onDragEnter: () => setIsHovering(true),
71+
onDragLeave: () => setIsHovering(false),
72+
})
8773
</script>
88-
89-
<style scoped lang="less"></style>
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
<template>
2-
<div>A组件props event通信: {{ count }}</div>
3-
<div style="margin-top: 8px;">
4-
<a @click="changeGlobal">子组件A内进行全局</a>
5-
</div>
2+
<div>A组件props event通信: {{ count }}</div>
3+
<div style="margin-top: 8px;">
4+
<a @click="changeGlobal">子组件A内进行全局</a>
5+
</div>
66
</template>
77

88
<script lang="ts" setup>
9-
import { ref } from 'vue'
9+
import { ref } from 'vue'
1010
11-
import { useEventEmitter } from 'vue-hooks-plus'
11+
import { useEventEmitter } from 'vue-hooks-plus'
1212
13-
const event = useEventEmitter({ global: true })
14-
const props = defineProps<{
15-
event: any
16-
}>()
17-
const count = ref(0)
13+
const event = useEventEmitter({ global: true })
14+
const props = defineProps<{
15+
event: any
16+
}>()
17+
const count = ref(0)
1818
19-
props.event.useSubscription('change', () => {
20-
count.value += 1
21-
})
19+
props.event.useSubscription('change', () => {
20+
count.value += 1
21+
})
2222
23-
const changeGlobal = () => {
24-
event.emit('change')
25-
}
23+
const changeGlobal = () => {
24+
event.emit('change')
25+
}
2626
</script>
27-
28-
<style scoped lang="less"></style>
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<template>
2-
<div style="margin-top: 16px;">全局事件: {{ globalCount }}</div>
2+
<div style="margin-top: 16px;">全局事件: {{ globalCount }}</div>
33
</template>
44

55
<script lang="ts" setup>
6-
import { ref } from 'vue'
6+
import { ref } from 'vue'
77
8-
import { useEventEmitter } from 'vue-hooks-plus'
8+
import { useEventEmitter } from 'vue-hooks-plus'
99
10-
const event = useEventEmitter({ global: true })
11-
const globalCount = ref(0)
10+
const event = useEventEmitter({ global: true })
11+
const globalCount = ref(0)
1212
13-
event.useSubscription('change', () => {
14-
globalCount.value += 1
15-
})
13+
event.useSubscription('change', () => {
14+
globalCount.value += 1
15+
})
1616
</script>
17-
18-
<style scoped lang="less"></style>

packages/hooks/src/useEventEmitter/demo/demo.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,3 @@
3131
eventA.emit('change')
3232
}
3333
</script>
34-
35-
<style scoped lang="less"></style>

0 commit comments

Comments
 (0)