<template>
<div class="demo">
<profile-header :title="profileTitle" :imagePath="profileImagePath"></profile-header>
</div>
</template>
<style scoped>
.demo {
width: 750px;
background-color: #f2f3f4;
}
</style>
<script>
import ProfileHeader from '../components/profile-header.vue'
export default {
components: { ProfileHeader },
data () {
return {
profileTitle: "Lorem Ipsum",
profileImagePath: "http://...."
}
}
}
</script>
在 Weex 中,我创建了一个具有 title 和 imagePath 属性的可重用组件“profile-header”。看来我只能使用上面提供的代码将数据传递给这两个属性,我需要在其中定义两个变量。
无论如何,我可以通过在那里内联数据将数据传递给我的自定义组件吗?喜欢:
<profile-header :title="This is the hardcoded title" :imagePath="hard coded path"></profile-header>