40 lines
589 B
JavaScript
40 lines
589 B
JavaScript
// components/header/header.js
|
|
Component({
|
|
options: {
|
|
multipleSlots: true
|
|
},
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
title: {
|
|
type: String,
|
|
value: "默认数值"
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
test: '测试数据,哈哈哈哈'
|
|
},
|
|
|
|
observers: {
|
|
'test': function (newTest) {
|
|
console.log("newTest: ", newTest);
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
test() {
|
|
this.setData({
|
|
test: "你好"
|
|
})
|
|
this.triggerEvent("change", this.data.test)
|
|
}
|
|
}
|
|
}) |