RE: How get configuration params in adapted vue-cli project

chenhao wu, modified 5 Years ago. New Member Posts: 3 Join Date: 7/9/20 Recent Posts
We all know  the main entry point is in the index.js,  which calls  the original vue packaged entry method in the js/app.js. But how can I  get the portlet configuration params in my own codes? Is there any callback methods?
By the way, I have tried to export a default function in main.js, and It seems not work any way.
thumbnail
Ivan Zaera, modified 5 Years ago. Regular Member Posts: 119 Join Date: 10/1/13 Recent Posts
Sadly there's no way to obtain configuration params in adaptations, you need to use a real Liferay JS portlet (https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-generator-liferay-js) to do that.
This is because we don't have control over the bootstrapping of the adapted portlets so we cannot guarantee that we will be able to support that feature in the future: we are at the mercy of the adapted frameworks.
Also, adaptation is provided as a way to migrate already existing code and/or make use of platform agnostic code. Following that reasoning, if you are going to couple your portlet with Liferay, it is better to use a real Liferay JS portlet build. Not that you cannot develop using adapted portlets, but the other option is likely to give less trouble...
chenhao wu, modified 5 Years ago. New Member Posts: 3 Join Date: 7/9/20 Recent Posts
I use a replace-regexp loader  to inject the _LIFERAY_PARAMS_  through  a placeholder . That do the trick and meet my requirements temporarily. And many thanks notifying me that important information about adaptation.