Breaker преди 5 години
родител
ревизия
ecc78bae98
променени са 2 файла, в които са добавени 22 реда и са изтрити 23 реда
  1. 0 1
      src/main.js
  2. 22 22
      src/views/Article.vue

+ 0 - 1
src/main.js

@@ -12,4 +12,3 @@ installElementPlus(app)
 
 app.use(store).use(router).mount('#app')
 app.config.globalProperties.$axios = axios
-

+ 22 - 22
src/views/Article.vue

@@ -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;