<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>混合多个vue完整对象</title>
</head>
<body>
<div id="app" >
<div @click="myfunc">点击</div>
{{msg}}xxxww
<lk></lk>
{{this.$options.age}}
</div>
</body>
<template id="btn">
xxxxxxxxx
</template>
<script src="js/vue3.js">
</script>
<script type="text/javascript">
const myMix={
age:10,
data(){
return{msg:'xxx'};
},
template:"#btn"
}
const app=Vue.createApp({
mixins:[myMix],
data(){
return {msg:'ssww'}
},
components:{lk:myMix},
methods:{
myfunc(){
console.log(this)
}
}
});
app.mount("#app");
</script>
</html>