Skip to content

Instantly share code, notes, and snippets.

@znck
Created January 1, 2021 02:23
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 znck/af46a22b56f4ad652af5c68cf3ada158 to your computer and use it in GitHub Desktop.
Save znck/af46a22b56f4ad652af5c68cf3ada158 to your computer and use it in GitHub Desktop.
Preview API Example
<preview>
<setup
:requests="{
// Mock requests
'/api/repos': $p.repeat(10, id => ({ id })),
'/api/repos/:id': id => $p.x.getUser(id),
'/api/repos/znck0': $p.http.status(404),
}"
:components="{
// Mock components
MyComp: $p.stub()
}"
:state="{
name: ''
}"
:mocks="{
// Mock modules
'module': './mocks/module'
}"
/>
<MyComponent
v-model="$p.state.name"
@click="$p.on('MyComponent.click')"
:age="$p.number.age()"
:firstName="$p.string.name.first()"
>
<component :is="$p.component.image.unsplash('person')" />
</MyComponent>
</preview>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment