1 回答

TA貢獻2080條經驗 獲得超4個贊
使用 PageRenderer 的 addRequireJsConfiguration 方法解決此問題,并將此代碼添加到 ext_localconf.php
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class)->addRequireJsConfiguration([
'shim' => [
'bootstrapTable' => ['jquery'],
'bootstrapTableLocale' => ['jquery', 'bootstrapTable'],
],
'paths' => [
'bootstrapTable' => \TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath(
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('iancalendar', 'Resources/Public/JavaScript/Contrib/')
) . 'bootstrap-table.min',
'bootstrapTableLocale' => \TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath(
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('iancalendar', 'Resources/Public/JavaScript/Contrib/')
) . 'bootstrap-table-locale-all.min',
]
]);
這樣我就可以像這樣加載 Main.js 中的模塊
define([
'jquery',
'bootstrapTable',
'bootstrapTableLocale'
], function($, bootstrapTable, bootstrapTableLocale) {
...
添加回答
舉報