ERROR TypeError: Cannot read property 'replace' of undefined

created at 07-05-2021 views: 2

description

error message

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

Reason for error:

let content = this.page_lang.tips; //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.
Please log in to leave a comment.