jhwxapp/miniprogram/newComponents/number/index.js

56 lines
931 B
JavaScript

// newComponents/number/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
number: {
type: Number,
},
},
observers: {
number:function(val){
this.numberArr()
}
},
lifetimes: {
created: function(){
//在组件实例刚刚被创建时执行,注意此时不能调用 setData
},
attached: function () {
//在组件实例进入页面节点树时执行
},
ready: function () {
// 在组件在视图层布局完成后执行
this.numberArr();
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
/**
* 组件的初始数据
*/
data: {
people:[]
},
/**
* 组件的方法列表
*/
methods: {
numberArr(){
var n = this.data.number.toString().split('')
this.setData({
people:n
})
}
}
})