46 lines
914 B
JavaScript
46 lines
914 B
JavaScript
/**
|
|
* 顶部header
|
|
*/
|
|
Vue.component("people-number", {
|
|
template: `
|
|
<div style="display: flex;align-items: center">
|
|
<div class="people-number-con">
|
|
<div v-for="item in people" v-html="item"></div>
|
|
</div>
|
|
<div v-if="unit" style="">{{unit}}</div>
|
|
</div>
|
|
|
|
`,
|
|
props: {
|
|
number: {
|
|
type: Number,
|
|
},
|
|
unit:{
|
|
type:String
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
people:[]
|
|
}
|
|
},
|
|
mounted(){
|
|
this.init()
|
|
},
|
|
methods: {
|
|
init(){
|
|
this.setData()
|
|
},
|
|
setData(){
|
|
var people = this.number != undefined?this.number.toString().split(''):0;
|
|
this.people = people
|
|
}
|
|
},
|
|
watch:{
|
|
number: function (n,o) {
|
|
this.init()
|
|
}
|
|
}
|
|
|
|
})
|