Skip to content

Vue3 Creating Component Instances Programmatically #2331

@art2limit

Description

@art2limit

What problem does this feature solve?

In vue2 it was be easy:

<template>
 <button :class="type"><slot /></button>
</template>

<script>
 export default {
   name: 'Button',
   props: [ 'type' ],
 }
</script>
import Button from 'Button.vue'
import Vue from 'vue'

var ComponentClass = Vue.extend(Button)
var instance = new ComponentClass()

instance.$mount() // pass nothing
this.$refs.container.appendChild(instance.$el)

extend create instance. But in vue3 it's has been deleted. Where are another way?

What does the proposed API look like?

Like vue2

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