ratiw / vuetable-2-tutorial

MIT License
258 stars 67 forks source link

How to access component data in slot? #80

Closed viewplatgh closed 6 years ago

viewplatgh commented 6 years ago

E.g. https://github.com/ratiw/vuetable-2-tutorial/wiki/lesson-11#__slotname--v120

If I have some data in MyVuetable.vue

data {
  return {
    notice: 'Important info...'
  }
}

How to access and use it in slot template? I cannot find an example for the case. E.g. like this:

    <template slot="actions" scope="props">   // <----
      <div class="custom-actions">
        <span>{{ notice }}</span>
        <button class="ui basic button"
          @click="onAction('view-item', props.rowData, props.rowIndex)">
          <i class="zoom icon"></i>
        </button>
        <button class="ui basic button"
          @click="onAction('edit-item', props.rowData, props.rowIndex)">
          <i class="edit icon"></i>
        </button>
        <button class="ui basic button"
          @click="onAction('delete-item', props.rowData, props.rowIndex)">
          <i class="delete icon"></i>
        </button>
      </div>
    </template>
viewplatgh commented 6 years ago

Never mind, it can be accessed directly. My one was an annoying 'invisible' spelling error issue...