描述为空是undfind的问题

This commit is contained in:
dinglink 2020-03-20 22:07:34 +08:00
parent 1621380ba8
commit 22c00f5ce3
3 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class IndexItem extends Component{
<img className="p-r-photo" alt="" src={getImageUrl(`images/${item.author && item.author.image_url}`)} ></img> <img className="p-r-photo" alt="" src={getImageUrl(`images/${item.author && item.author.image_url}`)} ></img>
<div className="p-r-Infos"> <div className="p-r-Infos">
<div className="p-r-name"> <div className="p-r-name">
<Link to={`/projects/${item.id}/${item.author && item.author.login}/coder`} className="hide-1 font-16 color-grey-3" style={{whiteSpace:"wrap"}}>{item.name}</Link> <Link to={`/projects/${item.id}/${item.author && item.author.login}/coder`} className="hide-1 font-16 color-grey-3" style={{whiteSpace:"wrap",display:'flex'}}><p className="task-hide font-18" style={{width:50,marginTop:5}}>{item.author.name}</p>{item.name}</Link>
</div> </div>
<div className="p-r-content"> <div className="p-r-content">
<p className="break_word task-hide flex1" style={{maxHeight:"40px",width:"0"}}>{item.description}</p> <p className="break_word task-hide flex1" style={{maxHeight:"40px",width:"0"}}>{item.description}</p>

View File

@ -314,11 +314,13 @@ class Detail extends Component{
commentCtx = (ctx) => { commentCtx = (ctx) => {
let _ctx = null; let _ctx = null;
try { try {
_ctx = JSON.parse(ctx); _ctx = JSON.parse(ctx);
} catch (e) { } catch (e) {
_ctx = ctx; _ctx = ctx;
} }
return ( return (
<QuillForEditor <QuillForEditor
readOnly={true} readOnly={true}
@ -463,7 +465,8 @@ class Detail extends Component{
readOnly={true} readOnly={true}
value={ data && data.description} value={ data && data.description}
/> */} /> */}
{this.commentCtx(data && data.description)}
{data&&data.description===""?<span className="color-grey-9 ml3 mr3">没有描述</span>:this.commentCtx(data && data.description)}
</div> </div>
{ {
data && data.attachments && data.attachments.length > 0 ? data && data.attachments && data.attachments.length > 0 ?

View File

@ -208,7 +208,6 @@ function QuillForEditor({
const previous = quill.getContents() const previous = quill.getContents()
if (value && value.hasOwnProperty('ops')) { if (value && value.hasOwnProperty('ops')) {
// console.log(value.ops);
const ops = value.ops || []; const ops = value.ops || [];
ops.forEach((item, i) => { ops.forEach((item, i) => {
if (item.insert['image']) { if (item.insert['image']) {