File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+
3
+ < style >
4
+ # demo {
5
+ font-family : 'Helvetica' , Arial, sans-serif;
6
+ }
7
+ a {
8
+ text-decoration : none;
9
+ color : # f66 ;
10
+ }
11
+ li {
12
+ line-height : 1.5em ;
13
+ margin-bottom : 20px ;
14
+ }
15
+ .author , .date {
16
+ font-weight : bold;
17
+ }
18
+ </ style >
19
+
20
+ < ul id ="demo ">
21
+ < h1 > Latest Vue.js Commits</ h1 >
22
+ < li v-repeat ="commits ">
23
+ < a href ="{{html_url}} " target ="_blank " class ="commit "> {{sha.slice(0, 7)}}</ a >
24
+ - < span class ="message "> {{commit.message | truncate}}</ span > < br >
25
+ by < span class ="author "> {{commit.author.name}}</ span >
26
+ at < span class ="date "> {{commit.author.date | formatDate}}</ span >
27
+ </ li >
28
+ </ ul >
29
+
30
+ < script src ="../../dist/vue.js "> </ script >
31
+ < script >
32
+ var demo = new Vue ( {
33
+ el : '#demo' ,
34
+ filters : {
35
+ truncate : function ( v ) {
36
+ var newline = v . indexOf ( '\n' )
37
+ return newline > 0 ? v . slice ( 0 , newline ) : v
38
+ } ,
39
+ formatDate : function ( v ) {
40
+ return v . replace ( / T | Z / g, ' ' )
41
+ }
42
+ } ,
43
+ created : function ( ) {
44
+ var xhr = new XMLHttpRequest ( )
45
+ xhr . open ( 'GET' , 'https://api.github.com/repos/yyx990803/vue/commits?per_page=3' )
46
+ xhr . onload = function ( ) {
47
+ demo . commits = JSON . parse ( xhr . responseText )
48
+ }
49
+ xhr . send ( )
50
+ }
51
+ } )
52
+ </ script >
You can’t perform that action at this time.
0 commit comments