<template>
<div>
appMain
// is可传值, 来决定渲染的元素, v-bind将多个属性绑定到元素身上
<component :is="eleType" v-bind="{href:'http://www.baidu.com',target:'_blank'}">
百度
</component>
</div>
</template>
<script>
export default {
name: 'AppMain',
data () {
return {
}
},
computed: {
eleType () {
return 'a'
}
}
}
</script>
<style scoped>
</style>
vue中<component>和v-bind用法
最新推荐文章于 2024-05-01 10:00:25 发布