tl;dr:
Use
<example :data="{{ json_encode($data) }}"></example> for Blade and
props: ['data'] for component.
Beware of using
{!! !!} for content contains
" and
'.
—
Recently I write a lot of Laravel and VueJS 2 then faced with the common case when want to pass PHP variables to VueJS component.
There are a lot of proposed methods including pass as global JS variables, pass as a slot, and pass as a props.
Each one has its own advantages and disadvantages here I will explain.