如何使用 Laravel 从 VUE 中的存储文件夹导入 JSON?
How to import JSON from Storage Folder in VUE using Laravel?
我正在寻找比这更简洁的方法:
<script>
import list from '../../../../../../../storage/app/public/json/listofcuisines_en.json';
export default {}
</script>
如何?
可以在webpack.mix.js
中使用webpack resolve
mix.webpackConfig({
resolve: {
alias: {
"@": path.resolve(
__dirname,
"your_path_to_source_folder"
)
}
}
});
然后在组件
<script>
import list from '@/storage/app/public/json/listofcuisines_en.json';
export default {}
</script>
我正在寻找比这更简洁的方法:
<script>
import list from '../../../../../../../storage/app/public/json/listofcuisines_en.json';
export default {}
</script>
如何?
可以在webpack.mix.js
mix.webpackConfig({
resolve: {
alias: {
"@": path.resolve(
__dirname,
"your_path_to_source_folder"
)
}
}
});
然后在组件
<script>
import list from '@/storage/app/public/json/listofcuisines_en.json';
export default {}
</script>