Authored by htoooth

next page

@@ -33,8 +33,6 @@ router.afterEach(() => { @@ -33,8 +33,6 @@ router.afterEach(() => {
33 window.scrollTo(0, 0); 33 window.scrollTo(0, 0);
34 }); 34 });
35 35
36 -  
37 -  
38 new Vue({ 36 new Vue({
39 el: '#app', 37 el: '#app',
40 router: router, 38 router: router,
1 <style scoped> 1 <style scoped>
2 -.layout{ 2 +.layout {
3 background: #f5f7f9; 3 background: #f5f7f9;
4 position: relative; 4 position: relative;
5 overflow: hidden; 5 overflow: hidden;
6 } 6 }
7 -.layout-logo{ 7 +.layout-logo {
8 width: 100px; 8 width: 100px;
9 height: 30px; 9 height: 30px;
10 background: #5b6270; 10 background: #5b6270;
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 top: 15px; 14 top: 15px;
15 left: 20px; 15 left: 20px;
16 } 16 }
17 -.layout-nav{ 17 +.layout-nav {
18 width: 420px; 18 width: 420px;
19 margin: 0 auto; 19 margin: 0 auto;
20 margin-right: 20px; 20 margin-right: 20px;
@@ -66,25 +66,17 @@ @@ -66,25 +66,17 @@
66 </div> 66 </div>
67 </template> 67 </template>
68 <script> 68 <script>
69 - export default {  
70 - 69 +export default {
71 created() { 70 created() {
72 - this.$router.push({name: 'similar.list'}) 71 + this.$router.push({ name: "similar.list" });
73 }, 72 },
74 methods: { 73 methods: {
75 open(name) { 74 open(name) {
76 - this.$router.push({name}) 75 + this.$router.push({ name });
77 }, 76 },
78 goTop() { 77 goTop() {
79 - this.$refs.backtop.back()  
80 - },  
81 - goNext() {  
82 - this.$bus.emit('gonext')  
83 - },  
84 - goBack() {  
85 - this.$bus.emit('goback')  
86 - }  
87 - 78 + this.$refs.backtop.back();
88 } 79 }
89 } 80 }
  81 +};
90 </script> 82 </script>
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 </Form> 29 </Form>
30 </div> 30 </div>
31 <Table :columns="columns" :data="list"></Table> 31 <Table :columns="columns" :data="list"></Table>
32 - <Page :total="pager.rows" :current="pager.page" :page-size="pager.size" @on-change="onPageChange" show-elevator style="margin-top:20px;text-align: right;"></Page> 32 + <Page ref="page" :total="pager.rows" :current="pager.page" :page-size="pager.size" @on-change="onPageChange" show-elevator style="margin-top:20px;text-align: right;"></Page>
33 </div> 33 </div>
34 </template> 34 </template>
35 <script> 35 <script>
@@ -53,7 +53,7 @@ export default { @@ -53,7 +53,7 @@ export default {
53 } 53 }
54 }); 54 });
55 }, 55 },
56 - className: 'top' 56 + className: "top"
57 }, 57 },
58 { 58 {
59 title: "相似图", 59 title: "相似图",
@@ -83,7 +83,7 @@ export default { @@ -83,7 +83,7 @@ export default {
83 </div> 83 </div>
84 ); 84 );
85 }, 85 },
86 - className: 'top' 86 + className: "top"
87 } 87 }
88 ], 88 ],
89 list: [], 89 list: [],
@@ -107,6 +107,12 @@ export default { @@ -107,6 +107,12 @@ export default {
107 this.api = new ApiService(); 107 this.api = new ApiService();
108 this.getList(); 108 this.getList();
109 }, 109 },
  110 + mounted() {
  111 + document.addEventListener("keydown", this.keydown);
  112 + },
  113 + destroyed() {
  114 + document.removeEventListener("keydown", this.keydown);
  115 + },
110 methods: { 116 methods: {
111 onPageChange(page) { 117 onPageChange(page) {
112 this.pager.page = page; 118 this.pager.page = page;
@@ -160,7 +166,7 @@ export default { @@ -160,7 +166,7 @@ export default {
160 this.pager.size = result.size; 166 this.pager.size = result.size;
161 167
162 this.$nextTick(() => { 168 this.$nextTick(() => {
163 - this.$emit('backtop'); 169 + this.$emit("backtop");
164 }); 170 });
165 171
166 msg(); 172 msg();
@@ -169,6 +175,19 @@ export default { @@ -169,6 +175,19 @@ export default {
169 msg(); 175 msg();
170 this.$Message.error("查询失败"); 176 this.$Message.error("查询失败");
171 }); 177 });
  178 + },
  179 + keydown(evt) {
  180 + if (evt.code === "ArrowLeft") {
  181 + this.goBack();
  182 + } else if (evt.code === "ArrowRight") {
  183 + this.goNext();
  184 + }
  185 + },
  186 + goNext() {
  187 + this.$refs.page.next()
  188 + },
  189 + goBack() {
  190 + this.$refs.page.prev()
172 } 191 }
173 }, 192 },
174 components: { 193 components: {