Vue-cli 3:如何使用确定路径的静态资产?

我的应用地址:

https:/firstpath.com/firstsubfolder/app.html

使用我的静态资产的相对路径:

https:/firstpath.com/firstsubfolder/img/image.png

如何为我的静态资产使用确定的路径?例如:

https:/secondpath.com/secondsubfolder/thirdsubfolder/img/image.png
jiansiliangjian 回答:Vue-cli 3:如何使用确定路径的静态资产?

如果您的资产位于https://secondpath.com/secondsubfolder/thirdsubfolder上 但是,如果您的应用程序在另一个域上,则只需为每个资源调用具有完整URL的资源即可。

如果您的应用程序URL为https://firstdomain.com/firstapp/app.html,则可以从https://fristdomain.com/anotherdir/assets.js调用资产。

,

由于您已经在使用vue cli3,因此只需在vue.config.js中设置assetsdir属性即可。 有关更多信息,请访问https://cli.vuejs.org/config/#assetsdir

本文链接:https://www.f2er.com/3075644.html

大家都在问