@stonecrop/beam 0.2.55 → 0.2.56
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/dist/beam.js +289 -278
- package/dist/beam.js.map +1 -1
- package/dist/beam.umd.cjs +1 -1
- package/dist/beam.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ListItem.vue +10 -1
- package/src/components/ListView.vue +4 -3
package/package.json
CHANGED
|
@@ -17,13 +17,22 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
|
-
import { ref } from 'vue'
|
|
20
|
+
import { ref, watch } from 'vue'
|
|
21
21
|
|
|
22
22
|
import ItemCount from '@/components/ItemCount.vue'
|
|
23
23
|
import ItemCheck from '@/components/ItemCheck.vue'
|
|
24
24
|
import type { ListViewItem } from '@/types'
|
|
25
25
|
|
|
26
26
|
const { item } = defineProps<{ item: ListViewItem }>()
|
|
27
|
+
const emit = defineEmits<{ update: [item: ListViewItem] }>()
|
|
27
28
|
|
|
28
29
|
const listItem = ref(item)
|
|
30
|
+
|
|
31
|
+
watch(
|
|
32
|
+
listItem,
|
|
33
|
+
value => {
|
|
34
|
+
emit('update', value)
|
|
35
|
+
},
|
|
36
|
+
{ deep: true }
|
|
37
|
+
)
|
|
29
38
|
</script>
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<li v-for="item in items" :key="item.label">
|
|
4
4
|
<template v-if="item.linkComponent">
|
|
5
5
|
<component :is="item.linkComponent" :to="item.route" tabindex="-1">
|
|
6
|
-
<ListItem :item="item"></ListItem>
|
|
6
|
+
<ListItem :item="item" @update="handleUpdate"></ListItem>
|
|
7
7
|
</component>
|
|
8
8
|
</template>
|
|
9
9
|
<template v-else>
|
|
10
|
-
<ListItem :item="item"></ListItem>
|
|
10
|
+
<ListItem :item="item" @update="handleUpdate"></ListItem>
|
|
11
11
|
</template>
|
|
12
12
|
</li>
|
|
13
13
|
</ul>
|
|
@@ -20,7 +20,7 @@ import ListItem from '@/components/ListItem.vue'
|
|
|
20
20
|
import type { ListViewItem } from '@/types'
|
|
21
21
|
|
|
22
22
|
defineProps<{ items: ListViewItem[] }>()
|
|
23
|
-
const emit = defineEmits<{ scrollbottom: [] }>()
|
|
23
|
+
const emit = defineEmits<{ update: [item: ListViewItem]; scrollbottom: [] }>()
|
|
24
24
|
|
|
25
25
|
onMounted(() => {
|
|
26
26
|
window.addEventListener('scroll', handleScroll)
|
|
@@ -30,6 +30,7 @@ onUnmounted(() => {
|
|
|
30
30
|
window.removeEventListener('scroll', handleScroll)
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
+
const handleUpdate = (item: ListViewItem) => emit('update', item)
|
|
33
34
|
const handleScroll = () => {
|
|
34
35
|
const scrollHeightDifference = document.documentElement.scrollHeight - window.innerHeight
|
|
35
36
|
const scrollposition = document.documentElement.scrollTop
|