123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _carousel = require("antd/es/carousel");
-
- var _carousel2 = _interopRequireDefault(_carousel);
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- require("antd/es/carousel/style/css");
-
- var _react = require("react");
-
- var _react2 = _interopRequireDefault(_react);
-
- require("./Emoji.css");
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- function _possibleConstructorReturn(self, call) { if (!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) { if (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 } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- // import emoji, { prefixUrl } from "../../emoji";
-
-
- // 每页 20 5*4
- // 共 20 * 3 = 60 (实际是 54)
-
- // class Emoji
-
- var Emoji = function (_React$Component) {
- _inherits(Emoji, _React$Component);
-
- function Emoji() {
- _classCallCheck(this, Emoji);
-
- return _possibleConstructorReturn(this, (Emoji.__proto__ || Object.getPrototypeOf(Emoji)).apply(this, arguments));
- }
-
- _createClass(Emoji, [{
- key: "next",
- value: function next() {
- if (this.carousel) {
- this.carousel.next();
- }
- }
- }, {
- key: "prev",
- value: function prev() {
- if (this.carousel) {
- this.carousel.prev();
- }
- }
- }, {
- key: "render",
- value: function render() {
- var _this2 = this;
-
- var _props = this.props,
- _onClick = _props.onClick,
- emojiList = _props.emojiList;
-
- var content = [];
- // let curPage = [];
- // for (let i = 0; i < 115; i++) {
- // if (curPage.length < 30) {
- // curPage.push(emoji[i]);
- // } else {
- // content.push(curPage);
- // curPage = [];
- // }
- // }
- // if (curPage.length > 0) {
- // content.push(curPage);
- // }
- for (var i = 0; i < emojiList.length; i += 30) {
- content.push(emojiList.slice(i, i + 30));
- }
-
- return _react2.default.createElement(
- _carousel2.default,
- {
- ref: function ref(node) {
- _this2.carousel = node;
- }
- },
- content.map(function (page, index) {
- return _react2.default.createElement(
- "div",
- { key: index, className: "emoji" },
- page.map(function (item, index) {
- return _react2.default.createElement(
- "div",
- { className: "item", key: item.id },
- _react2.default.createElement("img", {
- src: item.url,
- alt: item.name,
- style: { display: "inline-block", width: "28px" },
- onClick: function onClick() {
- return _onClick(item.name);
- }
- })
- );
- })
- );
- })
- );
- }
- }]);
-
- return Emoji;
- }(_react2.default.Component);
-
- exports.default = Emoji;
- //# sourceMappingURL=Emoji.js.map
|