Skip to content

Instantly share code, notes, and snippets.

@nabrown
Created July 28, 2018 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabrown/e57ef4bcb2b3ba42562f1e00e392f805 to your computer and use it in GitHub Desktop.
Save nabrown/e57ef4bcb2b3ba42562f1e00e392f805 to your computer and use it in GitHub Desktop.
A functional, single-file component
<template functional>
<figure :class="props.type" v-on:click="listeners.click">
<img :src="props.src" />
<figcaption v-if="slots().default">
<span><slot></slot></span>
</figcaption>
<div class="tags" v-if="props.tags && props.type != 'framed'">
<span v-for="tag in props.tags"> {{ tag }}</span>
</div>
</figure>
</template>
<script>
export default {
name: 'FigureFunctionalSFC',
props: {
src: {
required: true,
type: String
},
type: {
required: true,
type: String
},
tags: {
required: false,
type: Array
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment