feat: 添加子文章crud

This commit is contained in:
橙子
2023-03-14 22:58:35 +08:00
parent 2824e1325d
commit 295cf5e066
10 changed files with 75 additions and 24 deletions

View File

@@ -15,7 +15,6 @@ import { ref,watch } from 'vue';
const outputHtml=ref("")
const props = defineProps(['code'])
watch(props,(n,o)=>{
marked.setOptions({
renderer: new marked.Renderer(),
highlight: function(code) {

View File

@@ -38,7 +38,6 @@ onMounted(() => {
//使用传入值
if(props.userInfo!= undefined)
{
console.log(props.userInfo,"props.userInfo333");
userInfo.icon=props.userInfo.icon;
userInfo.name=props.userInfo.name;
userInfo.role=props.userInfo.role;

View File

@@ -1,7 +1,7 @@
<template>
<el-tree
:data="props.data"
:props="defaultProps"
:data="data"
:props="props.defaultProps"
@node-click="handleNodeClick"
:expand-on-click-node="false"
node-key="id"
@@ -9,8 +9,15 @@
<template #default="{ node, data }">
<span class="custom-tree-node">
<span>{{ node.label }}</span>
<span>{{data.name}}</span>
<span>
<a style="color: #409EFF; margin-left: 8px" @click="$emit('create',node, data)"
> + </a>
<a style="color: #409EFF; margin-left: 8px" @click="$emit('update',node, data)"
> 编辑 </a>
<a style="color: #f56c6c; margin-left: 8px" @click="$emit('remove',node, data)"
> 删除 </a>
@@ -22,6 +29,7 @@
<script setup>
const props = defineProps(['data'])
const emits= defineEmits(["handleNodeClick"])
//数据定义
//子文章数据
// const articleData =ref([]);
@@ -37,6 +45,6 @@ const defaultProps = {
// }
//点击事件
const handleNodeClick = (data) => {
console.log(data);
emits('handleNodeClick',data)
};
</script>