File tree Expand file tree Collapse file tree 7 files changed +9225
-37
lines changed Expand file tree Collapse file tree 7 files changed +9225
-37
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 21
21
"insert-css" : " ^0.2.0" ,
22
22
"stylus" : " ^0.49.1" ,
23
23
"uglify-js" : " ^2.4.15" ,
24
- "vueify" : " ^0 .1.0" ,
25
- "watchify" : " ^2.0.0 "
24
+ "vueify" : " ^1 .1.0" ,
25
+ "watchify" : " ^2.1.1 "
26
26
},
27
27
"dependencies" : {
28
28
"director" : " ^1.2.3" ,
29
29
"firebase" : " ^1.1.1" ,
30
- "vue" : " git://github.com/yyx990803/vue#next "
30
+ "vue" : " 0.11.3 "
31
31
}
32
32
}
Original file line number Diff line number Diff line change 69
69
</span >
70
70
</div >
71
71
<!-- main view -->
72
- <div v-component =" {{view}}" v-transition ></div >
72
+ <div v-component =" {{view}}" v-with = " params:params " v- transition ></div >
73
73
</template >
74
74
75
75
<script >
Original file line number Diff line number Diff line change 20
20
</style >
21
21
22
22
<template >
23
- <div class =" comhead" >
24
- <a class =" toggle" v-on =" click:open = !open" >{{open ? '[-]' : '[+]'}}</a >
25
- <a href =" #/user/{{by}}" >{{by}}</a >
26
- {{time | fromNow}} ago
27
- </div >
28
- <div class =" comment-content" v-html =" text" v-show =" open" ></div >
29
- <ul class =" child-comments" v-if =" kids" v-show =" open" >
30
- <li v-repeat =" comments" v-component =" comment" ></li >
31
- </ul >
23
+ <li v-show =" text" >
24
+ <div class =" comhead" >
25
+ <a class =" toggle" v-on =" click:open = !open" >{{open ? '[-]' : '[+]'}}</a >
26
+ <a href =" #/user/{{by}}" >{{by}}</a >
27
+ {{time | fromNow}} ago
28
+ </div >
29
+ <div class =" comment-content" v-html =" text" v-show =" open" ></div >
30
+ <ul class =" child-comments" v-if =" kids" v-show =" open" >
31
+ <li v-repeat =" comments" v-component =" comment" ></li >
32
+ </ul >
33
+ </li >
32
34
</template >
33
35
34
36
<script >
35
37
var store = require (' ../store' )
36
38
37
39
module .exports = {
40
+ replace: true ,
38
41
data : function () {
39
42
return {
40
43
open: true ,
Original file line number Diff line number Diff line change 19
19
</style >
20
20
21
21
<template >
22
- <div class =" view item-view" v-with = " id:params.itemId " v- show =" item" >
22
+ <div class =" view item-view" v-show =" item" >
23
23
<div class =" item" v-component =" item" v-with =" item" ></div >
24
24
<ul class =" poll-options" v-if =" pollOptions" >
25
25
<li v-repeat =" pollOptions" >
28
28
</li >
29
29
</ul >
30
30
<ul class =" comments" v-if =" comments" >
31
- <li v-repeat =" comments" v-component =" comment" v-show = " text " ></li >
31
+ <li v-repeat =" comments" v-component =" comment" ></li >
32
32
</ul >
33
33
<p v-show =" !comments.length" >No comments yet.</p >
34
34
</div >
@@ -41,19 +41,23 @@ module.exports = {
41
41
replace: true ,
42
42
data : function () {
43
43
return {
44
- id: null ,
44
+ params: {
45
+ itemId: null
46
+ },
45
47
item: null ,
46
48
pollOptions: null ,
47
- comments: null
49
+ comments: []
48
50
}
49
51
},
52
+ watch: {
53
+ ' params.itemId' : ' update'
54
+ },
50
55
compiled : function () {
51
56
this .update ()
52
- this .$watch (' id' , this .update )
53
57
},
54
58
methods: {
55
59
update : function () {
56
- store .fetchItem (this .id , function (item ) {
60
+ store .fetchItem (this .params . itemId , function (item ) {
57
61
this .item = item
58
62
this .fetchComments ()
59
63
if (item .type === ' poll' ) {
Original file line number Diff line number Diff line change 18
18
</style >
19
19
20
20
<template >
21
- <div class =" view news-view" v-with = " page:params.page " v- class =" loading:!items.length" >
21
+ <div class =" view news-view" v-class =" loading:!items.length" >
22
22
<!-- item list -->
23
23
<ul >
24
- <li class =" item" v-repeat =" items" v-component =" item" trackby =" id" ></li >
24
+ <li class =" item" v-repeat =" items" v-component =" item" track-by =" id" ></li >
25
25
</ul >
26
26
<!-- navigation -->
27
27
<div class =" nav" v-show =" items.length > 0" >
28
- <a v-if =" page > 1" href =" #/news/{{page - 1}}" >< ; prev</a >
29
- <a v-if =" page < 4" href =" #/news/{{page + 1}}" >more...</a >
28
+ <a v-if =" params. page > 1" href =" #/news/{{params. page - 1}}" >< ; prev</a >
29
+ <a v-if =" params. page < 4" href =" #/news/{{params. page + 1}}" >more...</a >
30
30
</div >
31
31
</div >
32
32
</template >
@@ -38,15 +38,19 @@ module.exports = {
38
38
replace: true ,
39
39
data : function () {
40
40
return {
41
- page: 1 ,
41
+ params: {
42
+ page: 1
43
+ },
42
44
displayPage: 1 ,
43
45
items: []
44
46
}
45
47
},
48
+ watch: {
49
+ ' params.page' : ' update'
50
+ },
46
51
compiled : function () {
47
52
this .update ()
48
53
store .on (' update' , this .update )
49
- this .$watch (' page' , this .update )
50
54
},
51
55
destroyed : function () {
52
56
store .removeListener (' update' , this .update )
@@ -56,9 +60,9 @@ module.exports = {
56
60
},
57
61
methods: {
58
62
update : function () {
59
- store .fetchItemsByPage (this .page , function (items ) {
63
+ store .fetchItemsByPage (this .params . page , function (items ) {
60
64
this .items = items
61
- this .displayPage = this .page
65
+ this .displayPage = this .params . page
62
66
}.bind (this ))
63
67
}
64
68
}
Original file line number Diff line number Diff line change 13
13
</style >
14
14
15
15
<template >
16
- <div class =" view user-view" v-with = " id:params.userId " v- show =" user" >
16
+ <div class =" view user-view" v-show =" user" >
17
17
<ul >
18
18
<li ><span class =" label" >user:</span > {{user.id}}</li >
19
19
<li ><span class =" label" >created:</span > {{user.created | fromNow}} ago</li >
@@ -37,13 +37,17 @@ module.exports = {
37
37
replace: true ,
38
38
data : function () {
39
39
return {
40
- id: null ,
41
- user: null
40
+ params: {
41
+ userId: null
42
+ },
43
+ user: {}
42
44
}
43
45
},
46
+ watch: {
47
+ ' params.userId' : ' update'
48
+ },
44
49
compiled : function () {
45
50
this .update ()
46
- this .$watch (' id' , this .update )
47
51
},
48
52
methods: {
49
53
update : function () {
You can’t perform that action at this time.
0 commit comments