我来自React背景,想知道如何模拟这行代码:var modal = <Login/>
目前我已经有了以下代码,但是变量的输出结果是一个字符串:
<template src="./App.html"></template>
<script>
import 'jquery'
import 'uikit'
import 'uikit/dist/css/uikit.min.css'
import Login from '@/Login.vue'
import Register from '@/Register.vue'
export default {
name: 'app',
components: {
"Login": Login,
"Register": Register
},
data: function () {
return {
message: "first",
modal: {
body: "test",
title: "body"
}
}
},
methods: {
modal_open: function(type) {
if (type === "login")
{
this.modal = {
body: Login,
title: "login"
}
}
else
{
this.modal = {
body: Register,
title: "Register"
}
}
},
}
}
</script>