vue3 已没有extend改为使用createApp
<template>
<div id="test"></div>
<div id="test1"></div>
</template>
<script>
import {h, createApp} from 'vue'
import HelloWorld from './components/HelloWorld.vue'
export default {
mounted() {
let a = createApp({
render() {
return h('div', {style: {fontSize: '24px'}}, '你好')
}
})
let b = createApp(HelloWorld)
a.mount('#test')
b.mount('#test1')
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
#效果预览
转载请注明出处