UNPKG

@antmjs/vantui

Version:

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

44 lines 2.63 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; var _excluded = ["wrapperStyle", "active", "anchorStyle", "index", "children", "style", "className"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } import { Text, View } from '@tarojs/components'; import React, { useState } from 'react'; import * as utils from '../wxs/utils'; import { get } from '../default-props'; import { Fragment as _Fragment } from "react/jsx-runtime"; import { jsx as _jsx } from "react/jsx-runtime"; export function IndexAnchor(props) { var _useState = useState(get().IndexAnchor), _useState2 = _slicedToArray(_useState, 1), d = _useState2[0]; var _d$props = _objectSpread(_objectSpread({}, d), props), wrapperStyle = _d$props.wrapperStyle, active = _d$props.active, anchorStyle = _d$props.anchorStyle, index = _d$props.index, children = _d$props.children, style = _d$props.style, className = _d$props.className, others = _objectWithoutProperties(_d$props, _excluded); return /*#__PURE__*/_jsx(View, _objectSpread(_objectSpread({ className: "van-index-anchor-wrapper ".concat(className || ''), style: utils.style([wrapperStyle, style]) }, others), {}, { children: /*#__PURE__*/_jsx(View, { className: 'van-index-anchor ' + (active ? 'van-index-anchor--active van-hairline--bottom' : ''), style: anchorStyle, children: children ? /*#__PURE__*/_jsx(_Fragment, { children: children }) : /*#__PURE__*/_jsx(_Fragment, { children: /*#__PURE__*/_jsx(Text, { children: index }) }) }) })); } IndexAnchor.displayName = 'IndexAnchor'; export default IndexAnchor;