1
1
<template >
2
2
<div >
3
- <div class =" main" v-for =" ( todo,index) in comments" v-if = " index < 5 " >
3
+ <div class =" main" v-for =" todo in comments" >
4
4
<div style =" margin-bottom : 15px " >
5
5
<div style =" display : inline-block " >
6
6
<img src =" ../assets/head.svg" style =" width :35px " >
7
7
</div >
8
8
<div class =" info" style =" display : inline-block " >
9
9
<span style =" font-size : 15px ;color : #333 ;" >{{todo.name}}</span ><br />
10
- <span style =" font-size : 12px ;color : #969696 ;" >{{comments.length-index +"楼."}}{{todo.create_time|data}}</span >
10
+ <span style =" font-size : 12px ;color : #969696 ;" >{{todo.id +"楼."}}{{todo.create_time|data}}</span >
11
11
</div >
12
12
</div >
13
13
{{todo.content}}
14
14
</div >
15
- <div class =" block" style =" margin-top :30px " >
15
+ <!-- < div class="block" style="margin-top:30px">
16
16
<el-pagination
17
17
layout="prev, pager, next"
18
18
:total="comments.length/.5"
19
19
@current-change="changePage"
20
20
:current-page="current">
21
- </el-pagination >
21
+ </el-pagination> -->
22
22
</div >
23
23
</div >
24
24
</template >
25
25
<script >
26
26
export default {
27
27
/* eslint-disable */
28
28
data () {
29
- let comment = {
30
- name: " 白植熙" ,
31
- content: " 测试测试测试测试试测试测试测试测试测试测试测试测试测试测测试测试测试" ,
32
- create_time: 1512997751 ,
33
- id: 1
34
- }
35
- let comments = new Array ;
36
- for (let i = 0 ; i < 12 ; i++ ){
37
- comments .push (comment)
38
- }
29
+ let comments = [];
39
30
return {
40
31
comments,
41
32
current: 1 ,
@@ -45,8 +36,16 @@ export default {
45
36
changePage (val ){
46
37
console .log (` 当前页: ${ val} ` );
47
38
this .current = val;
39
+ },
40
+ getlist (){
41
+ alert (' 6666' )
48
42
}
49
43
},
44
+ beforeCreate : function () {
45
+ this .$http (" http://www.bai3.xyz/comment/getlist" )
46
+ .then (response => {console .log (response);this .comments = response .data .reverse ()})
47
+ },
48
+
50
49
filters: {
51
50
// 时间戳过滤器
52
51
data : function (input ){
0 commit comments