Skip to content

Not initialize boolean property properly #1020

Closed
@TerenceZ

Description

@TerenceZ

Example:

<test></test>

<script>
new Vue({
    el: "body",
    components: {
        "test": {
            props: [
                {
                    name: "prop",
                    type: Boolean
                }
            ],
            data() {
                return {
                    prop: true
                };
            }
        }
    }
});
</script>

After initialized, the test's prop is set to false, not the specified value true, who initialized in data(). I find that the compiler set the boolean value to false as default before initializing the default data).

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