Skip to content

Instantly share code, notes, and snippets.

import Vue from ‘vue’
import { storiesOf } from ‘@storybook/vue’
import Profile from ‘@/views/profile/Profile’
storiesOf(‘Profile’, module)
  .add(‘with a profile image’, () => ({
  components: { Profile },
  template: ‘<Profile />’
  }))
<template>
<div>
<img :src="profileImage">
</div>
</template>
<script>
export default {
name: 'Profile',
storiesOf('Profile', module)
.add('with a profile image', () => ({
components: { Profile },
data () {
return {
image: 'https://vuejs.org/images/logo.png'
}
},
template: '<profile :profile-image="image" />'
}))
<script>
...
data () {
return {
result: {},
loaded: false
}
},
mounted () {
<template>
  <div>
  <Profile 
  v-if=”loaded”
  :profile-image=”result.profile.profile_image”
  />
  </div>
</template>
<template>
 <div>
 <Profile 
  v-if=”loaded”
  :profile-image=”result.profile.profile_image”
  :profile-data=”result.profile”
  />
  </div>
</template>
<template>
<div>
<img :src="profileImage">
<div>
Name: {{ profileData.name }}
</div>
<div>
Location: {{ profileData.location }}
</div>
<div>
storiesOf('Profile', module)
.add('with a profile image', () => ({
components: { Profile },
data () {
return {
image: 'https://vuejs.org/images/logo.png',
profileData: {
name: 'Lachlan',
location: 'Tokyo',
about: 'Software dev, steem and AI/ML'
<template>
<div>
<Profile
v-if=”loaded”
:profile-image=”result.profile.profile_image”
:profile-data=”result.profile”
/>
</div>
</template>
import { configure } from ‘@storybook/vue’
import Vue from ‘vue’
function loadStories () {
require(‘../src/stories’)
}
configure(loadStories, module);