java import as_How to import the folder as Vue component

在Vue中,开发者希望根据设备类型展示不同的组件。例如,对于Card组件,创建了CardMobile.vue专用于移动设备。目标是将这两个组件放在Card文件夹内,通过index.js来决定加载Card.vue还是CardMobile.vue。提问者询问是否可以在App.vue中导入Card,由index.js动态选择加载的组件。这是一个关于前端框架响应式设计和模块化组织的问题。
摘要由CSDN通过智能技术生成

I want to display different Vue component for the mobile device. And I found this solution (https://stackoverflow.com/a/48515205/11079653) via mixin.

And, for example, I have the component - Card.vue. But for the mobile device, I have created CardMovile.Vue.

Now I want to put these components in the folder Card which will contain index.js

-Card

--Card.vue

--CardMobile.vue

--index.js

After that, I just want import Card in my App.vue and index.js should decide what component needed (Card.vue or Card.mobile.vue)

import Card from './Card'

is it possible?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值