UNPKG

@antmjs/vantui

Version:

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

49 lines 1.75 kB
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; /* eslint-disable */ import react from 'react'; import { Cell, Cascader } from '@antmjs/vantui'; import { regionData, CodeToText } from 'element-china-area-data'; 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), isVisible = _react$useState2[0], setIsVisible = _react$useState2[1]; var _react$useState3 = react.useState([]), _react$useState4 = _slicedToArray(_react$useState3, 2), value1 = _react$useState4[0], setValue1 = _react$useState4[1]; var _react$useState5 = react.useState([]), _react$useState6 = _slicedToArray(_react$useState5, 2), title = _react$useState6[0], setTitle = _react$useState6[1]; var change1 = function change1(value) { setValue1(value); setTitle([CodeToText[value[0]], CodeToText[value[1]], CodeToText[value[2]]]); }; return /*#__PURE__*/_jsxs(_Fragment, { children: [/*#__PURE__*/_jsx(Cell, { title: "\u9009\u62E9\u5730\u5740", value: title.length ? title.join('-') : '请选择地址', onClick: function onClick() { setIsVisible(true); } }), /*#__PURE__*/_jsx(Cascader // scrollIntoView={false} , { childrenKey: "children", visible: isVisible, value: value1, textKey: "label", title: "\u5730\u5740\u9009\u62E9", options: regionData, closeable: true, onClose: function onClose() { setIsVisible(false); }, onChange: change1 })] }); }