electricity_bill_calc_wx/components/Segmented/index.js
2025-02-20 10:38:29 +08:00

32 lines
512 B
JavaScript

// components/Segmented/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
list: Array,
active: Number,
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
handleChange(e) {
console.log(e, this.data.active)
const { index } = e.currentTarget.dataset;
if (index === this.data.active) {
return;
}
this.triggerEvent("change", { index, name: this.data.list[index] })
}
}
})