Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How get configuration params in adapted vue-cli project
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.
By the way, I have tried to export a default function in main.js, and It seems not work any way.
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...
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...
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.