Vue.extend cannot display template content

use Vue.extend (require (". / message.vue")); to import a message component into body. For some reason, only the template in the empty div,message.vue of el has been imported. What"s the problem?

src/components/toast/index.js

import Vue from "vue";

let MyMsgConstructor = Vue.extend(require("./message.vue"));

let instance;

let message = function (msg) {
    instance = new MyMsgConstructor({
        el: document.createElement("div"),
        data: {
            message: msg,
            visible: true
        }
    });
    
    document.body.appendChild(instance.$el);
    return instance;
};


export default message;

src/components/toast/message.vue

 <template>
    <transition name="el-message-fade">
        <div v-show="visible" class="my-msg">{{message}}</div>
    </transition>
</template>

<script>
    export default {
        data() {
            return {
                message: "",
                visible: true
            }
        },
        methods: {
            close() {
                setTimeout(() => {
                    this.visible = false;
                }, 2000)
            },
        },
        mounted() {
            this.close();
        }
    }
</script>

main.js

import message from "./components/toast/index.js"
Vue.$message = Vue.prototype.$message = message;

use

openToast() {
    this.$message("test");
}
Mar.03,2021

  //dom
  instance.vm = instance.$mount()

import toast from'@ / components/common/toast/toast.vue';

const ToastConstructor = Vue.extend (toast);

it can be solved in this way. Import

first.

as to why, Vue.extend (require ('. / message.vue')); can't do this. I can't find the problem for the time being

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30719-40d57.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30719-40d57.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?