@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
56 lines • 1.53 kB
JavaScript
import { Form, Button, Dialog, FormRender } 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";
var Dialog_ = Dialog.createOnlyDialog();
export default function Index() {
var form = Form.useForm();
return /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx(Dialog_, {}), /*#__PURE__*/_jsx(FormRender, {
form: form,
config: [{
fields: 'account',
type: 'inputNumber',
required: true,
label: '账号'
}, {
fields: 'name',
type: 'input',
label: '名称'
}, {
fields: 'radio',
type: 'radio',
label: '价格',
options: [{
name: '选项1',
value: '1'
}, {
name: '选项2',
value: '2'
}]
}, {
fields: 'price',
type: 'inputPrice',
label: '价格'
}]
}), /*#__PURE__*/_jsx(Button, {
style: {
width: '100%',
marginTop: '20px'
},
type: "primary",
onClick: function onClick() {
console.info(form.getFieldsValue());
form.validateFields(function (err, res) {
console.info(form.getFieldsValue());
if (!(err !== null && err !== void 0 && err.length)) {
Dialog_.alert({
message: JSON.stringify(res)
});
}
});
},
children: "\u63D0\u4EA4"
})]
});
}