Created
January 1, 2021 02:23
-
-
Save znck/af46a22b56f4ad652af5c68cf3ada158 to your computer and use it in GitHub Desktop.
Preview API Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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