UNPKG

@antmjs/vantui

Version:

一套适用于Taro3及React的vantui组件库

32 lines 1 kB
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; /* eslint-disable */ import react from 'react'; import { Dialog, Switch } from '@antmjs/vantui'; import { jsx as _jsx } from "react/jsx-runtime"; import { Fragment as _Fragment } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; export default function Demo() { var _react$useState = react.useState(false), _react$useState2 = _slicedToArray(_react$useState, 2), value = _react$useState2[0], setValue = _react$useState2[1]; var action = function action(e) { Dialog.confirm({ selector: '#switch-demo', title: '提示', message: '是否切换开关?' }).then(function () { setValue(e.detail); }).catch(function (e) { console.log(e); }); }; return /*#__PURE__*/_jsxs(_Fragment, { children: [/*#__PURE__*/_jsx(Dialog, { id: "switch-demo" }), /*#__PURE__*/_jsx(Switch, { checked: value, onChange: action })] }); }