1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- "use strict";
-
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
- var _react = require("react");
-
- var _react2 = _interopRequireDefault(_react);
-
- var _reactDom = require("react-dom");
-
- var _reactDom2 = _interopRequireDefault(_reactDom);
-
- var _App = require("./App");
-
- var _App2 = _interopRequireDefault(_App);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-
-
- var Index = function Index(props) {
- return _react2.default.createElement(
- _App2.default,
- _extends({ showAlertComment: true, showAlertReply: true, showAlertFavor: true, showError: true }, props),
- _react2.default.createElement(_App.Editor, _extends({ maxUpload: 9, autoFocus: true }, props.editorProps))
- );
- };
-
-
- function renderComment(config) {
- if (!config.id) {
- throw new Error("id is required");
- }
- if (!config.type) {
- throw new Error("type is required");
- }
- if (!config.businessId) {
-
- config.businessId = "test";
- console.warn("没有传入 businessId 参数,默认使用: test");
- }
- if (!config.API) {
-
- config.API = "http://api.links123.net/comment/v1";
- console.warn("没有传入 API 参数,默认使用: http://api.links123.net/comment/v1");
- }
-
- _reactDom2.default.render(_react2.default.createElement(Index, config), document.getElementById(config.id));
-
- }
-
- window.renderComment = renderComment;
-
- if (process.env.NODE_ENV !== "production") {
- renderComment({
- id: "root-comment",
- type: 1,
- businessId: "test",
- businessUserId: 4,
- userId: 71299,
- onCountChange: function onCountChange(c) {
- console.log(c);
- },
- editorProps: {
-
- }
- });
- }
-
-
-
-
-
-
-
|