1
+ <template >
2
+ <div id =" index" >
3
+ <div class =" myContent" >
4
+ <div class =" searchItem" >
5
+ <div class =" row" >
6
+ <div class =" col-lg-3 col-md-3 col-sm-3 col-xs-3" >
7
+ <div class =" input-group" >
8
+ <span class =" input-group-btn" >
9
+ <button class =" btn btn-default" type =" button" >标题</button >
10
+ </span >
11
+ <input v-model =" title" type =" text" class =" form-control" placeholder =" Search for..." >
12
+ </div ><!-- /input-group -->
13
+ </div ><!-- /.col-lg-6 -->
14
+ <div class =" col-lg-3 col-md-3 col-sm-3 col-xs-3" >
15
+ <div class =" input-group" >
16
+ <span class =" input-group-btn" >
17
+ <button class =" btn btn-default" type =" button" >类别</button >
18
+ </span >
19
+ <input v-model =" classic" type =" text" class =" form-control" placeholder =" Search for..." >
20
+ </div >
21
+ </div >
22
+ <div class =" col-lg-3 col-md-3 col-sm-3 col-xs-3" >
23
+ <div class =" input-group" >
24
+ <span class =" input-group-btn" >
25
+ <button class =" btn btn-default" type =" button" >标签</button >
26
+ </span >
27
+ <input v-model =" tag" type =" text" class =" form-control" placeholder =" Search for..." >
28
+ </div >
29
+ </div >
30
+ <div class =" col-lg-1 col-md-1 col-sm-1 col-xs-1" >
31
+ <button class =" searchBtn btn btn-info" @click = " search" >查找</button >
32
+ </div >
33
+ </div >
34
+ </div >
35
+ <smartTable v-bind:get-message =" tableData" v-on:receiveData =" receiveData" ref =" changeItem" >
36
+ <tr slot =" thead" >
37
+ <th >标题</th >
38
+ <th >类别</th >
39
+ <th >标签</th >
40
+ <th >日期</th >
41
+ <th >作者</th >
42
+ <th >状态</th >
43
+ <th >浏览量</th >
44
+ <th >评论数</th >
45
+ <th >操作</th >
46
+ </tr >
47
+ <tr slot =" tbody" v-for =" item in Data" >
48
+ <td >{{item.title}}</td >
49
+ <td >{{item.classic}}</td >
50
+ <td >{{item.tags}}</td >
51
+ <td >{{item.time}}</td >
52
+ <td >{{item.author}}</td >
53
+ <td v-if =" item.show ==1" class =" btn-success btn-xs" >已发表</td >
54
+ <td v-if =" item.show ==0" class =" btn-info btn-xs" >撰写中</td >
55
+ <td >{{item.pv}}</td >
56
+ <td >{{item.markNum}}</td >
57
+ <td >
58
+ <button class =" btn btn-info btn-xs" @click = " toArticle(item.id,1)" >预览</button >
59
+ <button class =" btn btn-info btn-xs" v-if =" item.show ==0" @click = " toArticle(item.id,2)" >撰写</button >
60
+ <button v-if =" item.show ==1" @click = " downLine(item.id,item.title)" class =" btn btn-warning btn-xs" >下线</button >
61
+ <button v-if =" item.show ==0" @click = " upLine(item.id,item.title)" class =" btn btn-success btn-xs" >上线</button >
62
+ <button class =" btn btn-danger btn-xs" @click = " deleteArticle(item.id,item.title)" >删除</button >
63
+ </td >
64
+ </tr >
65
+ </smartTable >
66
+ </div >
67
+ </div >
68
+ </template >
69
+
70
+ <script >
71
+ import smartTable from ' ./components/smartTable.vue'
72
+ export default {
73
+ data () {
74
+ return {
75
+ tableData: {
76
+ ' method' : ' GET' ,
77
+ ' type' : ' async' ,
78
+ ' url' : ' ./static/json.json' ,
79
+ ' query' : {}
80
+ },
81
+ Data: [],
82
+ cityList: [
83
+ {
84
+ id: 1 ,
85
+ value: ' 全部'
86
+ },
87
+ {
88
+ id: 2 ,
89
+ value: ' 已发表'
90
+ },
91
+ {
92
+ id: 3 ,
93
+ value: ' 撰写中'
94
+ }
95
+ ],
96
+ status: 1 ,
97
+ title: ' ' ,
98
+ tag: ' ' ,
99
+ classic: ' '
100
+ }
101
+ },
102
+ components: {
103
+ smartTable
104
+ },
105
+ methods: {
106
+ receiveData (data ) {
107
+ this .Data = data
108
+ },
109
+ search () {
110
+ let paramsObj = {}
111
+ if (this .title ) {
112
+ paramsObj .title = this .title
113
+ }
114
+ if (this .status ) {
115
+ paramsObj .show = this .show
116
+ }
117
+ if (this .tag ) {
118
+ paramsObj .tag = this .tag
119
+ }
120
+ if (this .classic ) {
121
+ paramsObj .classic = this .classic
122
+ }
123
+ this .$refs .changeItem .fetchData (paramsObj)
124
+ }
125
+ },
126
+ mounted () {
127
+ if (document .body .clientHeight < window .innerHeight ) {
128
+ document .getElementById (' index' ).style .height = window .innerHeight + ' px'
129
+ }
130
+ }
131
+ }
132
+ </script >
133
+
134
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
135
+ <style scoped>
136
+ #index{
137
+ background-color: #f5f5d5;
138
+ font-family: Georgia, serif;
139
+ letter-spacing: -0.01em;
140
+ word-spacing: 0.2em;
141
+ width: 100%;
142
+ height:100%;
143
+ padding-top: 30px;
144
+ }
145
+ .myContent{
146
+ width:90%;
147
+ margin-left:5%;
148
+ background:white;
149
+ padding:50px;
150
+ }
151
+ .searchItem{
152
+ height:50px;
153
+ }
154
+ .searchBtn{
155
+ width:100%;
156
+ }
157
+ </style>
0 commit comments