vantui-edit
Version:
一套适用于Taro3及React的vantui组件库
63 lines (58 loc) • 2.92 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["vertical", "type", "color", "size", "textSize", "className", "children", "style"];
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 { View } from '@tarojs/components';
import { useState } from 'react';
import * as utils from '../wxs/utils';
import * as computed from './wxs';
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 function Loading(props) {
var vertical = props.vertical,
_props$type = props.type,
type = _props$type === void 0 ? 'circular' : _props$type,
color = props.color,
size = props.size,
textSize = props.textSize,
className = props.className,
children = props.children,
style = props.style,
others = _objectWithoutProperties(props, _excluded);
var _useState = useState(Array.from({
length: 12
})),
_useState2 = _slicedToArray(_useState, 1),
array12 = _useState2[0];
return /*#__PURE__*/_jsxs(View, _objectSpread(_objectSpread({
className: ' ' + utils.bem('loading', {
vertical: vertical
}) + ' ' + className,
style: utils.style([style])
}, others), {}, {
children: [/*#__PURE__*/_jsx(View, {
className: 'van-loading__spinner van-loading__spinner--' + type,
style: computed.spinnerStyle({
color: color,
size: size
}),
children: type === 'spinner' && /*#__PURE__*/_jsx(_Fragment, {
children: array12.map(function (_, index) {
return /*#__PURE__*/_jsx(View, {
className: "van-loading__dot"
}, "van-loading__dot_".concat(index));
})
})
}), /*#__PURE__*/_jsx(View, {
className: "van-loading__text",
style: computed.textStyle({
textSize: textSize
}),
children: children
})]
}));
}
export default Loading;