[Vuejs]-How to pass php object or array to Vue prop (Not Blade)?

0👍

Just to give you a full answer here: The reason, why there is a problem is, that either you need to use " or ' for your html attribute. This leads to the problem, that you might have both of them inside your json output.

To avoid that, you need to encode html entities inside your json string like

<vue-component :language="<?php htmlentities(json_encode($frontLanguage), ENT_QUOTES) ?>" />

Leave a comment