Skip to content

Instantly share code, notes, and snippets.

@SidneyAllen
Last active October 29, 2021 18:21
Show Gist options
  • Save SidneyAllen/d69196bf14220b852980acb7932b5202 to your computer and use it in GitHub Desktop.
Save SidneyAllen/d69196bf14220b852980acb7932b5202 to your computer and use it in GitHub Desktop.
// src/components/ListTemplates.vue
<script setup>
import { reactive, onMounted } from "vue";
const templates = reactive({});
onMounted(() => {
fetch("http://localhost:3030/templates")
.then((data) => data.json())
.then((data) => (templates.value = data));
});
</script>
<template>
<ul class="flex">
<li v-for="template in templates.value">
<h3>{{ template.description }}</h3>
<p>Created on {{ template.date_created }}.</p>
<p><a :href="'https://dashboard.lob.com/#/templates/' + template.id" target="_blank">Preview</a></p>
</li>
</ul>
</template>
<style scoped>
li {
display: block;
}
.template-frame {
width: 200px;
height:300px;
overflow: hidden;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment