|
|
@@ -23,40 +23,39 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
export default {
|
|
|
components: [],
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
article: {},
|
|
|
articleID: 0,
|
|
|
- content: "",
|
|
|
- authorName: "",
|
|
|
+ content: '',
|
|
|
+ authorName: '',
|
|
|
circleUrl:
|
|
|
- "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
|
|
|
- };
|
|
|
+ '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: {
|
|
|
- getArticle(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);
|
|
|
- });
|
|
|
+ const result = response.data[0]
|
|
|
+ this.article = result
|
|
|
+ this.content = result.content
|
|
|
+ this.getAuthor(result.author_id)
|
|
|
+ })
|
|
|
},
|
|
|
- getAuthor(id) {
|
|
|
+ getAuthor (id) {
|
|
|
this.$axios.get(`/users/info/${id}`).then((response) => {
|
|
|
- console.log(response);
|
|
|
- this.authorName = response.data[0].user_name;
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ console.log(response)
|
|
|
+ this.authorName = response.data[0].user_name
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<style>
|
|
|
#avatar {
|
|
|
@@ -66,6 +65,7 @@ export default {
|
|
|
margin-left: 20px;
|
|
|
position: relative;
|
|
|
}
|
|
|
+
|
|
|
#author_name {
|
|
|
display: inline;
|
|
|
font-size: 15px;
|