2

I've been working VUEJS Vuetables, despite I read about components and slots I cannot figure how to add a link with the following structure on each row:

<td class="text-center">
<a href="{{ url('/order/'.$order->id) }}" class="btn btn-outline btn-danger btn-lg"><i class="fas fa-globe"></i>
</a>
</td>

1- I created a the column

        data: {
            columns: [
                {
                    name: '__component:gcp-actions',
                    title: 'Actions',
                    titleClass: 'text-center',
                    dataClass: 'text-center'
                }

2- I created gcpaction component:

<template>
    <div class="custom-actions">
        <a v-bind:href="rowData.view" v-if="show" class="btn btn-flat bg-green btn-sm"><i
                class="glyphicon glyphicon-zoom-in"></i></a>
        <button class="btn btn-flat bg-red btn-sm" @click="itemAction('delete-item', rowData, rowIndex)"><i
                class="glyphicon glyphicon-trash"></i></button>
    </div>
</template>

I tried with <a> and with <button>

3- I registered the component in my table:

import GcpActions from './GcpActions'
Vue.component('gcp-actions', GcpActions)

4- When I render I can see the whole table but I cannot see the component in my table:

<vtable url="orders/filter" :columns="columns" :filters="filters"></vtable>

any help appreciated.

1 Answer 1

2

Have you tried scoped slots?

<span slot="columnName" slot-scope="props">
    <a href="/profiles/{{columnName.if}}"></a>
</span>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.