<template>
<div style = "justify-content:center">
<text class="label" >Vue.js Start Count</text>
<text class="count">{{count}}</text>
</div>
</template>
<script >
const stream = weex.requireModule('stream')
export default {
data(){
return {
count :'fetching...'
}
},
created(){
stream.fetch({
method:'GET',
type:'json',
url:'https://api.github.com/repos/vuejs/vue'
},res => {
if(res.ok){
this.count = res.data.stargazers_count
}else{
this.count = '- unkonwn -'
}
} )
}
}
</script>
<style scoped>
.label {
color:#666;
text-align: center;
font-size: 60px;
}
.count{
color: #41B883;
text-align: center;
font-size: 100px;
margin-top: 80px;
margin-bottom: 100px;
}
</style>
</script>

屏幕快照 2018-04-13 下午5.24.57.png
网友评论