mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { VantComponent } from '../../common/component';
|
|
import Dialog from '../../dialog/dialog';
|
|
import Notify from '../../notify/notify';
|
|
|
|
VantComponent({
|
|
methods: {
|
|
onClose(event) {
|
|
const { position, instance } = event.detail;
|
|
switch (position) {
|
|
case 'left':
|
|
case 'cell':
|
|
instance.close();
|
|
break;
|
|
case 'right':
|
|
Dialog.confirm({
|
|
context: this,
|
|
message: '确定删除吗?',
|
|
}).then(() => {
|
|
instance.close();
|
|
});
|
|
break;
|
|
}
|
|
},
|
|
|
|
onOpen(event) {
|
|
const { position, name } = event.detail;
|
|
switch (position) {
|
|
case 'left':
|
|
Notify({
|
|
context: this,
|
|
type: 'primary',
|
|
message: `${name}${position}部分展示open事件被触发`,
|
|
});
|
|
break;
|
|
case 'right':
|
|
Notify({
|
|
context: this,
|
|
type: 'primary',
|
|
message: `${name}${position}部分展示open事件被触发`,
|
|
});
|
|
break;
|
|
}
|
|
},
|
|
},
|
|
});
|