Hello,
I want to open an URL to a new tab from the interface page. I have created a custom widget to achieve this. This widget has a setting web_url that we can set in the widget configuration from the page.
I am setting a hard-coded URL in the widget setting as of now. I am facing one issue here. I can get the value set in the widget configuration in main.js code. I am returning the value from main.js, but I cant get the value in frontend.js. Below is my code.
Could you please let me know if I am doing something wrong here?
main.js
return {
get_template_data: function() {
var webLink = widget.get_setting(‘web_url’);
cs.log('webURL = '+ webLink);
return
{
web_link : webURL
}
},
get_settings: function() {
return {
web_url: {
main_label: "Web URL to Load",
base_format: 'string'
}
};
}
}
frontend.js
export default {
mounted: function() {
console.log('webLink = '+ this.web_link);
if(this.web_link)
{
window.open(this.web_link, '_blank');
}
$(document).ready(function(){
console.log('webLink 2 = '+ this.web_link);
});
},
methods: {
}
}
Thanks in advance.
Best Regards,
Mayur