ERROR TypeError: Cannot read property 'replace' of undefined

created at 07-05-2021 views: 66


error message

Pay attention to the prompts and click to know the error line. (Uniapp)

Reason for error:

let content =; //When initializing, there is no value here, and an error will be reported if there is no judgment below.
content = content.replace(/-\+num\+-/g,'<text class="ptNum" style="color:#f6375b;">' + this.remain_people+this.page_lang.people_unit +'</ text>'); //It is not judged whether the content is empty, and replace cannot be called if it is empty.
created at:07-05-2021
edited at: 07-05-2021: