-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7.6日课后思考题1 #2
Comments
不懂,瞎答一个,把卡片类型(组件类型),放到这个数据 https://github.com/FE-star/Plan-2022/blob/main/page-transformer/src/utils/data.js 里? |
想办法把卡片注入也提到最上层,而不是在Grid里面写死。 |
绑定关系是指在楼层里配置了card属性吗?Grid里面写死的内容指的是? |
Grid里面写死了Card的引用啊~这样我的Schema要实现多一个Card,就要改Grid |
明白了,使用app.component(cardTypeName,组件)全局注册下就可以了 |
首先,楼层使用了
|
嗯,这样也可以。 |
嗯,也是可以的 |
app.vue <div v-for="(floor, floorIdx) in page" :key="floorIdx">
<!-- 不同的 grid -->
<component :floor="floor" :is="floor.type" v-slot="{ dataItem }">
<!-- 不同的 card -->
<component :data="dataItem" :is="floor.card"></component>
</component>
</div> grid.vue <div class="card-content clearfix">
<div
class="col"
v-for="(dataItem, dataItemIdx) in data"
:key="dataItemIdx"
>
<slot :dataItem="dataItem" />
</div>
</div> |
good |
当前楼层卡片类型其实是跟楼层有绑定关系,这样不利于楼层扩展,应该怎么做更好?
The text was updated successfully, but these errors were encountered: