Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Empty string is undefined #52

@pixelfriese

Description

@pixelfriese

Hi,

in my application I set an initial data variable as empty string in my component. My next step is to get the final value from an async call.

Within this time from initialization of the data variable and the overwrite from the ajax call the value is undefined. I have tested it without the ajax call and it is independent of it. If I have defined my variable in the data function of my component as an empty string, it got undefined.

My current dirty solution is to use an string with an empty line in it, because I don´t want an 'undefined' text in my page title.

This very simple example produce an undefined page title:

module.exports = {
    data: function () {
        return {
            title: ''
        }
    }

    metaInfo: function () {
        return {
            title: this.title,
            titleTemplate: '%s | MySite'
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions