Call questions similar to js functions split (), slice (), replace () in template template {{}}

after calling the background data interface, I forgot to deal with the date format returned in the background in the js code, and then the brain short circuit directly converts the data format in the < template > template. Split and replace can convert the data into the format I want, but there is a question: why the data has been converted successfully, the console still reported an error, and the error reported is still an error undefined by split and replace functions. My understanding is that since it is not defined, why does split and replace still work?
this is the code for format conversion in the template template. The format has been converted, but the error has been reported

.
<div class="useDate">*{{conponData.endTime.split(" ")[0].replace(/(\d{4})-(\d{2})-(\d{2})/g,"$1$2$3")}}</div>

this is format conversion in the interface method, which is generally handled in the same way, so there is no error

export async function getDetail(pkId) {
    const recData = await jsonAxios(CONPONDETAIL, {
        pkId: pkId
    })
    if (recData.status == 10000) {
        _this.conponData = recData.data;
        _this.description = _this.conponData.description.split("\n");
        _this.conponData.endTime = _this.conponData.endTime.split(" ")[0].replace(/(\d{4})-(\d{2})-(\d{2})/g,"$1$2$3");
    }
    console.log(recData);
}

Apr.09,2021
When the

page initializes, conponData is empty and endTime is undefined, so the split function cannot be found and an error is thrown


I have encountered this problem before, and later understood that the endTime in the conponData = {} empty object during
initialization is undefined

.
Menu