@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
42 lines • 1.21 kB
JavaScript
/* eslint-disable */
import react from 'react';
import { View } from '@tarojs/components';
import { Dialog, Cell } from '@antmjs/vantui';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export default function Demo() {
var alert = react.useCallback(function (title) {
var beforeClose = function beforeClose(action) {
return new Promise(function (resolve) {
setTimeout(function () {
if (action === 'confirm') {
resolve(true);
} else {
// 拦截取消操作
resolve(false);
}
}, 1000);
});
};
Dialog.alert({
title: title || '',
message: '弹窗内容',
theme: 'round-button',
selector: 'vanDialog2',
beforeClose: beforeClose,
asyncClose: true
}).then(function (value) {
console.log('dialog result11', value);
});
}, []);
return /*#__PURE__*/_jsxs(View, {
children: [/*#__PURE__*/_jsx(Dialog, {
id: "vanDialog2"
}), /*#__PURE__*/_jsx(Cell, {
title: "\u5F02\u6B65\u5173\u95ED",
onClick: function onClick() {
return alert('点击等待1s关闭');
}
})]
});
}