Skip to content

Commit 0724335

Browse files
author
xrr2016
committed
⚡ edit list.vue
1 parent 08328a3 commit 0724335

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ function fetchData(count) {
4949
})
5050
}
5151

52-
fetchData(50)
52+
fetchData(5)

src/App.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<template>
22
<div id="app">
3-
<mu-appbar title="Title">
4-
<mu-icon-button icon='menu' slot="left"/>
5-
<mu-icon-button icon='expand_more' slot="right"/>
3+
<mu-appbar>
4+
{{ title }}
5+
<mu-icon-menu icon="menu" class="icon-menu">
6+
<mu-menu-item title="Help" />
7+
<mu-menu-item title="Sign out" />
8+
</mu-icon-menu>
69
</mu-appbar>
710
<router-view></router-view>
811
</div>
@@ -13,7 +16,7 @@ export default {
1316
name: 'app',
1417
data(){
1518
return {
16-
title : 'Movie List'
19+
title : '电影列表'
1720
}
1821
}
1922
}
@@ -33,4 +36,8 @@ export default {
3336
.title{
3437
letter-spacing: 1px;
3538
}
39+
.icon-menu{
40+
float: right;
41+
margin-right: 30px;
42+
}
3643
</style>

src/components/List.vue

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
<template lang="html">
22
<div class="list">
3-
List.vue
3+
<mu-table :fixedHeader="true" :showCheckbox="false" >
4+
<mu-thead>
5+
<mu-tr>
6+
<mu-th>ID</mu-th>
7+
<mu-th>电影海报</mu-th>
8+
<mu-th>电影名称</mu-th>
9+
<mu-th>上映年份</mu-th>
10+
<mu-th>主要演员</mu-th>
11+
<mu-th>评分</mu-th>
12+
<mu-th>操作</mu-th>
13+
</mu-tr>
14+
</mu-thead>
15+
<mu-tbody>
16+
<mu-tr v-for="movie of movies">
17+
<mu-td>{{ movie.id }}</mu-td>
18+
<mu-td><img :src="movie.image" :title="movie.original_title"></mu-td>
19+
<mu-td>{{ movie.title }}</mu-td>
20+
<mu-td>{{ movie.year }}</mu-td>
21+
<mu-td>
22+
<p v-for="cast of movie.casts">{{ cast.name }}</p>
23+
</mu-td>
24+
<mu-td>{{ movie.rating }}</mu-td>
25+
<mu-td>
26+
<mu-raised-button label="修改" primary/>
27+
<mu-raised-button label="删除" secondary/>
28+
</mu-td>
29+
</mu-tr>
30+
</mu-tbody>
31+
</mu-table>
32+
<mu-float-button icon="add" class="add-movie-btn"/>
433
</div>
534
</template>
635

@@ -19,7 +48,6 @@ export default {
1948
this.$http.get('/api/movie')
2049
.then(res => {
2150
this.movies = res.data
22-
console.dir(res.data[0])
2351
})
2452
.catch(err => {
2553
toastr.error(`${err.message}`,'ERROR!')
@@ -33,4 +61,8 @@ export default {
3361
<style lang="css">
3462
.list{
3563
}
64+
.add-movie-btn{
65+
position: fixed;
66+
bottom: 50px;
67+
}
3668
</style>

src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ toastr.options = {
3333
// const prefix = "https://images.weserv.nl/?url="
3434
// return prefix + url
3535
// })
36-
36+
Vue.filter('castsToString',(casts) => {
37+
return casts.map((item) => {return item.name}).toString().replace(/\,/g,"\n")
38+
})
3739

3840
/* eslint-disable no-new */
3941
new Vue({

0 commit comments

Comments
 (0)