Newer
Older
sample-vue-slot / src / App.vue
yhornisse on 11 Aug 2021 1 KB add sample
<template>
  <div id="app">
    <my-title>
      タイトル
    </my-title>
    <table>
      <thead>
        <tr>
          <th>No</th>
          <th>name</th>
          <th>desc</th>
        </tr>
      </thead>

      <tbody>
        <row v-for="i in items" :key="i">
	  <template slot="no">{{ i.no }}</template>
	  <template slot="name"><b>{{ i.name }}</b></template>
	  <template slot="desc"><i>{{ i.desc }}</i></template>
	</row>
      </tbody>
    </table>
  </div>
</template>

<script>
import Row from "./components/Row.vue";
import MyTitle from "./components/MyTitle.vue";

export default {
  name: "app",
  components: {
    Row,
    MyTitle,
  },
  data() {
    return {
      items: [
        {
          no: 1,
          name: "Taro",
          desc: "hoge"
        },
        {
          no: 2,
          name: "Ken",
          desc: "fuga"
        },
        {
          no: 3,
          name: "Jiro",
          desc: "piyo"
        },
      ]
    };
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
table,
tr,
td,
th {
  border: solid 1px #000000;
  border-collapse: collapse;
}
</style>