You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
883 B

2 months ago
Component({
properties: {
visible: {
type: Boolean,
value: false
},
classList: {
type: Array,
value: []
}
},
data: {
selectedClassName: ''
},
methods: {
selectClass(e) {
this.setData({
selectedClassName: e.currentTarget.dataset.name
});
},
confirmSelection() {
if (this.data.selectedClassName) {
this.triggerEvent('confirm', { className: this.data.selectedClassName });
this.setData({ visible: false }); // 隐藏弹窗
} else {
wx.showToast({
title: '请选择班级',
icon: 'none'
});
}
},
cancelSelection() {
this.setData({ visible: false }); // 隐藏弹窗
this.triggerEvent('cancel'); // 可选:触发取消事件
}
}
});