Closed pocka closed 6 years ago
Add partial support for story that have render function instead of template. Since Vue.js is not supported custom renderer for now, this changes do hacks: call render function manually with custom createElement callback which returns JSX string.
render
template
createElement
See: #36
Accessing this in render throws an exception.
this
withInfo('summary', (() => ({ data() { return { name: 'pocka' } }, render(h) { return h('p', [`Hello, ${this.name}`]) // Error } })))
All variables will be evaluated.
const foo = 3 return <p>{foo}</p>
will be
return <p>{3}</p>
Functions will be inlined.
const myFunc = ev => console.log(ev) return <div onClick={myFunc}>foo</div>
;<div onClick={function (ev) {console.log(ev);}}>foo</div>
Summary
Add partial support for story that have
render
function instead oftemplate
. Since Vue.js is not supported custom renderer for now, this changes do hacks: callrender
function manually with customcreateElement
callback which returns JSX string.See: #36
Limitations
Accessing
this
inrender
throws an exception.All variables will be evaluated.
will be
Functions will be inlined.
will be