|
@@ -2,13 +2,15 @@
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="14" :offset="5">
|
|
<el-col :span="14" :offset="5">
|
|
|
<el-container>
|
|
<el-container>
|
|
|
- <el-header style="font-size: 35px;">{{article.article_title}}</el-header>
|
|
|
|
|
- <el-main style="text-align:left;">
|
|
|
|
|
|
|
+ <el-header style="font-size: 35px">
|
|
|
|
|
+ {{ article.article_title }}
|
|
|
|
|
+ </el-header>
|
|
|
|
|
+ <el-main style="text-align: left">
|
|
|
<el-container>
|
|
<el-container>
|
|
|
<el-header>
|
|
<el-header>
|
|
|
<div id="avatar">
|
|
<div id="avatar">
|
|
|
<el-avatar :size="40" :src="circleUrl"></el-avatar>
|
|
<el-avatar :size="40" :src="circleUrl"></el-avatar>
|
|
|
- <div id="author_name">{{authorName}}</div>
|
|
|
|
|
|
|
+ <div id="author_name">{{ authorName }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-header>
|
|
</el-header>
|
|
|
<el-main v-html="content"></el-main>
|
|
<el-main v-html="content"></el-main>
|
|
@@ -19,43 +21,45 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+
|
|
|
<script>
|
|
<script>
|
|
|
-import axios from 'axios'
|
|
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
components: [],
|
|
components: [],
|
|
|
- data () {
|
|
|
|
|
|
|
+ data() {
|
|
|
return {
|
|
return {
|
|
|
article: {},
|
|
article: {},
|
|
|
articleID: 0,
|
|
articleID: 0,
|
|
|
- content: '',
|
|
|
|
|
- authorName: '',
|
|
|
|
|
- circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ content: "",
|
|
|
|
|
+ authorName: "",
|
|
|
|
|
+ circleUrl:
|
|
|
|
|
+ "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
- mounted () {
|
|
|
|
|
- this.articleID = this.$route.params.id
|
|
|
|
|
- this.getArticle(this.articleID)
|
|
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.articleID = this.$route.params.id;
|
|
|
|
|
+ this.getArticle(this.articleID);
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- getArticle (id) {
|
|
|
|
|
- axios.get(`http://localhost:3000/articles/${id}`).then(response => {
|
|
|
|
|
- const result = response.data[0]
|
|
|
|
|
- this.article = result
|
|
|
|
|
- this.content = result.content
|
|
|
|
|
- this.getAuthor(result.author_id)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ getArticle(id) {
|
|
|
|
|
+ this.$axios.get(`/articles/${id}`).then((response) => {
|
|
|
|
|
+ const result = response.data[0];
|
|
|
|
|
+ this.article = result;
|
|
|
|
|
+ this.content = result.content;
|
|
|
|
|
+ this.getAuthor(result.author_id);
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- getAuthor (id) {
|
|
|
|
|
- axios.get(`http://localhost:3000/users/info/${id}`).then(response => {
|
|
|
|
|
- console.log(response)
|
|
|
|
|
- this.authorName = response.data[0].user_name
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ getAuthor(id) {
|
|
|
|
|
+ this.$axios.get(`/users/info/${id}`).then((response) => {
|
|
|
|
|
+ console.log(response);
|
|
|
|
|
+ this.authorName = response.data[0].user_name;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
<style>
|
|
<style>
|
|
|
-#avatar{
|
|
|
|
|
|
|
+#avatar {
|
|
|
text-align: left;
|
|
text-align: left;
|
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
|
margin-bottom: 20px;
|
|
margin-bottom: 20px;
|