通用评论

index.js.map 2.3KB

1
  1. {"version":3,"sources":["../src/index.js"],"names":["Index","props","renderComment","config","id","Error","type","businessId","userId","ReactDOM","render","document","getElementById","window"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,IAAQ,WAAW,CAAnB,EAAsB,eAAtB;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;AAOA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,wBAAV,CAAN;AACD;AAT4B,MAUrBD,EAVqB,GAUyBD,MAVzB,CAUrBC,EAVqB;AAAA,qBAUyBD,MAVzB,CAUjBG,IAViB;AAAA,MAUjBA,IAViB,gCAUV,CAVU;AAAA,2BAUyBH,MAVzB,CAUPI,UAVO;AAAA,MAUPA,UAVO,sCAUM,MAVN;AAAA,MAUcC,MAVd,GAUyBL,MAVzB,CAUcK,MAVd;;;AAY7BC,qBAASC,MAAT,CACE,8BAAC,KAAD,IAAO,MAAMJ,IAAb,EAAmB,YAAYC,UAA/B,EAA2C,QAAQC,MAAnD,GADF,EAEEG,SAASC,cAAT,CAAwBR,EAAxB,CAFF;AAIA;AACD;;AAEDS,OAAOX,aAAP,GAAuBA,aAAvB;;AAEA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport App, { Editor } from \"./App\";\r\nimport registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nconst Index = props => (\r\n <App showAlertComment showAlertReply showAlertFavor showError {...props}>\r\n <Editor maxUpload={9} autoFocus />\r\n </App>\r\n);\r\n\r\n/**\r\n * 渲染评论组件\r\n * @param {object} config 编辑器配置\r\n * - {string} id 渲染评论的DOM的 ID\r\n * - {number} type 评论的 type\r\n * - {string} businessId 评论的 businessId\r\n */\r\nfunction renderComment(config) {\r\n if (!config.id) {\r\n throw new Error(\"id is required\");\r\n }\r\n if (!config.id) {\r\n throw new Error(\"type is required\");\r\n }\r\n if (!config.id) {\r\n throw new Error(\"businessId is required\");\r\n }\r\n const { id, type = 1, businessId = \"test\", userId } = config;\r\n\r\n ReactDOM.render(\r\n <Index type={type} businessId={businessId} userId={userId} />,\r\n document.getElementById(id)\r\n );\r\n // registerServiceWorker();\r\n}\r\n\r\nwindow.renderComment = renderComment;\r\n\r\n// renderComment({\r\n// id: \"root-comment\",\r\n// type: 1,\r\n// businessId: \"test\"\r\n// });\r\n"]}