File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/components/ListItemNode Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { computed } from ' vue'
23import NodeRenderer from ' ../NodeRenderer'
34
45// 节点子元素类型
@@ -15,19 +16,28 @@ interface ListItem {
1516 raw: string
1617}
1718
18- defineProps <{
19+ const props = defineProps <{
1920 item: ListItem
2021 indexKey? : number | string
22+ value? : number
2123}>()
2224
2325defineEmits <{
2426 copy: [text : string ]
2527}>()
28+
29+ const liValueAttr = computed (() =>
30+ props .value == null ? {} : { value: props .value },
31+ )
2632 </script >
2733
2834<template >
29- <li class =" list-item pl-1.5 my-2" dir =" auto" >
30- <NodeRenderer :index-key =" `list-item-${indexKey}`" :nodes =" item.children" @copy =" $emit('copy', $event)" />
35+ <li class =" list-item pl-1.5 my-2" dir =" auto" v-bind =" liValueAttr" >
36+ <NodeRenderer
37+ :index-key =" `list-item-${props.indexKey}`"
38+ :nodes =" props.item.children"
39+ @copy =" $emit('copy', $event)"
40+ />
3141 </li >
3242</template >
3343
You can’t perform that action at this time.
0 commit comments