href blade Laravel and Vue.js

3

I'm doing the list of registered receivers and in each line there is an edit button, in href, I need to use the encrypt and pass the id, but this id comes from Vue.js and the blade using {{} } does not recognize the Vue.js variable, so my question is how to pass this id, follow my code.

<tbody>
    <tr v-if="fornecedores.length == 0">
        <td colspan="5" class="text-center">NENHUM FORNECEDOR CADASTRADO</td>
    </tr>
    <tr v-for="fornecedor in fornecedores" :key="fornecedor.id">
        <td>@{{fornecedor.nome}}</td>
        <td class="text-center">@{{fornecedor.telefone1}}</td>
        <td class="text-center">@{{fornecedor.telefone2 ? fornecedor.telefone2 : '-'}}</td>
        <td class="text-center">@{{fornecedor.email ? fornecedor.email : '-'}}</td>
        <td class="text-nowrap text-center">
            <a href="{!! route('admin.fornecedores.gerenciar', encrypt(fornecedor.id)) !!}" data-toggle="tooltip" data-original-title="Alterar"> <i class="fa fa-pencil text-inverse m-r-10"></i> </a>
        </td>
    </tr>
</tbody>
    
asked by anonymous 01.10.2017 / 17:52

1 answer

0

This problem occurs because the blade uses the same delimiters that Vue.js uses by default, which causes Blade to attempt to interpret Vue variables and thus creates inconsistencies in its execution.

To resolve this issue, vue provides the "delimiters" property in your API , which allows you to change of which delimiters will be used.

new Vue({
    el: '#app',
    data: data,
    delimiters: ["${","}"]
});

This code modifies the Vue.js delimiters for $ {some_ thing}, so instead of {{some_ thing}} you would use $ {some_ thing}.

Another related discussion: link

    
03.10.2018 / 16:27