<template>
  <div class="q-pa-md">
    <q-table :title="name+'一覧'" row-key="name" :selection="type" v-model:selected="selected" :columns="columns" :rows="rows" />
  </div>
</template>
<script>
import { ref,onMounted,reactive } from 'vue'
import { api } from 'boot/axios';

export default {
  name: 'actionSelect',
  props: {
    name: String,
    type: String
  },
  setup() {
  const columns = [
  { name: 'name', required: true,label: 'アクション名',align: 'left',field: 'name',sortable: true},
  { name: 'desc', align: 'left', label: '説明', field: 'desc', sortable: true },
  { name: 'content', label: '内容', field: 'content', sortable: true }
  ]
  const rows = reactive([])
    onMounted( () => {
        api.get('http://127.0.0.1:8000/api/kintone/1').then(res =>{
         res.data.forEach((item) =>
        {
          rows.push({name:item.name,desc:item.desc,content:item.content});
        }
        )
      });
      });
    return {
      columns,
      rows,
      selected: ref([]),
    }
  },

}
</script>
