arielsalminen / vue-design-system

An open source tool for building UI Design Systems with Vue.js
https://vueds.com
MIT License
2.17k stars 225 forks source link

How to use v-model in sample code? #137

Closed ftom2 closed 5 years ago

ftom2 commented 5 years ago

Some components, like custom input elements, use v-model and I'd like to display it in the sample code.

So I want to write a doc like this:

<docs>
     <AqInput label="danger" danger value="Something went wrong" v-model="input1" id="input-4" />
</docs>

input1 does not really exist on the model' it's just for the example, and of course it throws an error. Is it possible to define a mock v-model?

arielsalminen commented 5 years ago

@ftom2 Definitely possible. Please see Styleguidist’s docs for documenting components: https://github.com/vue-styleguidist/vue-styleguidist/blob/master/docs/Documenting.md

dabernathy89 commented 4 years ago

If anyone is googling and trying to figure this out, I went with using a mixin to store a variable in data that can be reused across examples:

https://vue-styleguidist.github.io/docs/Cookbook.html#how-to-add-dummy-data-to-the-style-guide