父
article-detail为子组件名
<template>
<article-detail :is-edit="false" :staffID="staffId"/>
</template>
<script>
import ArticleDetail from "./components/ArticleDetail";
import { mapGetters } from "vuex";
export default {
name: "CreateArticle",
components: { ArticleDetail },
computed: {
...mapGetters(["name", "roles", "avatar", "id"]),
},
created() {
this.staffId = this.id;
},
data() {
return {
staffId: "",
};
},
};
</script>
子
props: {
isEdit: {
type: Boolean,
default: false,
},
staffID : {
type: String
}
},