【发布时间】:2018-09-13 11:51:15
【问题描述】:
我正在动态加载 vue 组件。但是它找不到路径。如何设置 webpack,以便我可以将完整路径添加到数组中而不是在 require 中连接它?
不工作
Vue.component(title, require(file));
<sau-page-nav :components="{{json_encode(['AddCredit'=>'../billing/AddCredit','PayPal'=>'../billing/PayPal'])}}"></sau-page-nav>
作品
Vue.component(title, require('../' + file));
<sau-page-nav :components="{{json_encode(['AddCredit'=>'billing/AddCredit','PayPal'=>'billing/PayPal'])}}"></sau-page-nav>
【问题讨论】:
-
你是在问为什么第二个有效,是这样吗?
-
是的...更新问题