npm install message-tree --save-dev
<template>
<div class="message-container">
<message-tree :data-list="dataList">
<!-- default slots of comment-editor -->
</message-tree>
</div>
</template>
<script>
export default {
data(){
return {
dataList:[
{
"thumbupCount": 4,
"email": "[email protected]",
"nickname": "nickname",
"content": "message",
"createdAt": "2020-02-29T03:57:51.466Z",
"updatedAt": "2020-02-29T10:37:39.238Z",
"id": "5e59e13f961db51ad45c9ebb",
"children": []
},
{
"thumbupCount": 0,
"email": "[email protected]",
"nickname": "昵称二",
"content": "这是第二个留言",
"createdAt": "2020-03-23T06:23:15.952Z",
"updatedAt": "2020-03-23T06:23:15.952Z",
"id": "5e7855d3ffbc160b9c2d3098",
"children": [
{
"thumbupCount": 0,
"email": "[email protected]",
"nickname": "昵称",
"content": "这是一条回复",
"parentID": "5e7855d3ffbc160b9c2d3098",
"createdAt": "2020-03-23T06:23:37.972Z",
"updatedAt": "2020-03-23T06:23:37.972Z",
"id": "5e7855e9ffbc160b9c2d3099",
"children": [
{
"thumbupCount": 0,
"email": "[email protected]",
"nickname": "昵称1",
"content": "这是一条@昵称的回复",
"parentID": "5e7855e9ffbc160b9c2d3099",
"createdAt": "2020-03-23T06:24:00.857Z",
"updatedAt": "2020-03-23T06:24:00.857Z",
"id": "5e785600ffbc160b9c2d309a",
"children": []
},
]
}
]
}
]
}
}
}
</script>