click to copy

practiced-songs
Matthew Huntington 1 year ago
parent 69d202079d
commit c4365dfe56

@ -12,6 +12,9 @@
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+event.target.value).then((response)=>{ axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'show-category/'+event.target.value).then((response)=>{
this.categorySessions = response.data; this.categorySessions = response.data;
}) })
},
copy(event){
navigator.clipboard.writeText(event.target.innerHTML);
} }
}, },
mounted() { mounted() {
@ -48,9 +51,9 @@
<tbody> <tbody>
<tr v-for="session in categorySessions"> <tr v-for="session in categorySessions">
<td>{{session.id}}</td> <td>{{session.id}}</td>
<td>{{session.description}}</td> <td @click="copy">{{session.description}}</td>
<td>{{session.seconds}}</td> <td @click="copy">{{session.seconds}}</td>
<td>{{session.comments}}</td> <td @click="copy">{{session.comments}}</td>
<td>{{session.created_at}}</td> <td>{{session.created_at}}</td>
<td>{{session.category_id}}</td> <td>{{session.category_id}}</td>
<td>{{session.category}}</td> <td>{{session.category}}</td>

@ -11,7 +11,12 @@
axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'songs').then((response)=>{ axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'songs').then((response)=>{
this.songs = response.data this.songs = response.data
}) })
},
methods: {
copy(event){
navigator.clipboard.writeText(event.target.innerHTML);
} }
},
} }
</script> </script>
@ -28,7 +33,7 @@
<tbody> <tbody>
<tr v-for="song in songs"> <tr v-for="song in songs">
<td>{{song.id}}</td> <td>{{song.id}}</td>
<td>{{song.title}}</td> <td @click="copy">{{song.title}}</td>
<td>{{song.notes}}</td> <td>{{song.notes}}</td>
</tr> </tr>
</tbody> </tbody>

Loading…
Cancel
Save