0
Vue
の変数を次の式のLaravel
のひし形括弧に入れることはできますか?問題はあなたがPHP書(サーバ側)の内側にVueの変数(クライアント側)にアクセスしようとしているあるVue inside of blade - 構文
Parse error: syntax error, unexpected '}', expecting ',' or ')'
Vue
の変数を次の式のLaravel
のひし形括弧に入れることはできますか?問題はあなたがPHP書(サーバ側)の内側にVueの変数(クライアント側)にアクセスしようとしているあるVue inside of blade - 構文
Parse error: syntax error, unexpected '}', expecting ',' or ')'
:これは私のようなエラーがスローされます
<a href="{{URL::route('frontend.article.show', ['slug' => '@{{article.slug}}', 'categoryId' =>'@{{ @article.id}}'])}}">"@{{article.title}}"></a>
。この問題を解決する1つの方法は、Vueのmounted()
メソッド内にリンクを作成することです。どのように次のようにあなたがこれを行うことができます。そして、
<a id="@{{ article.id }}" href="">@{{ article.title }}</a>
を次のように
まずタグを作成するには、Vueののmounted()
メソッド(またはcreated()
)内の適切なリンクを作成する必要があり
let path = "{{ route('frontend.article.show', ['slug' => 1, 'categoryId' => 2]) }}";
let url = path.replace(1, article.slug).replace(2, article.id);
// manipulate the DOM from here or pass it through to your data.
このそれにアプローチする一つの方法です。