all files / src/ CrumbItem.jsx

75.47% Statements 40/53
50% Branches 18/36
88.89% Functions 8/9
96.3% Lines 26/27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91                      29×   17×   17×                   17×   17×     17×   17×     17×                                                                          
'use strict';
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
 
var _react = require('react');
 
var _react2 = _interopRequireDefault(_react);
 
var _propTypes = require('prop-types');
 
var _propTypes2 = _interopRequireDefault(_propTypes);
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
 
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
 
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { Iif (keys.indexOf(i) >= 0) continue; Iif (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
 
function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
function _possibleConstructorReturn(self, call) { Iif (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
 
function _inherits(subClass, superClass) { Iif (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CrumbItem Component for uxcore
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * @author peijie.dpj
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2014-2015, Uxcore Team, Alinw.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * All rights reserved.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */
 
var CrumbItem = function (_React$Component) {
  _inherits(CrumbItem, _React$Component);
 
  function CrumbItem() {
    _classCallCheck(this, CrumbItem);
 
    return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
  }
 
  CrumbItem.prototype.render = function render() {
    var props = _objectWithoutProperties(this.props, []);
 
    Iif (props.onClick) {
      props.href = "javascript:void(0);";
    }
    return props.href ? _react2['default'].createElement(
      'a',
      props,
      props.children
    ) : _react2['default'].createElement(
      'span',
      props,
      props.children
    );
  };
 
  return CrumbItem;
}(_react2['default'].Component);
 
CrumbItem.defaultProps = {
  children: '链接'
 
  // http://facebook.github.io/react/docs/reusable-components.html
};CrumbItem.propTypes = {
  /**
   * @title 链接
   */
  href: _propTypes2['default'].string,
  /**
   * @title 类名
   * @veIgnore
   */
  className: _propTypes2['default'].string,
  /**
   * @title 文案
   */
  children: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].element]),
  /**
   * @title 点击事件
   * @veIgnore
   */
  onClick: _propTypes2['default'].func
};
 
CrumbItem.displayName = 'CrumbItem';
 
exports['default'] = CrumbItem;
module.exports = exports['default'];