Vue: Show code block doesn't render template
See original GitHub issueI am using Storybook for Vue v6.2.9
I have one component named BaseIcon. It has two props: icon and iconColor.
Why clicking the Show code button doesn’t show the actual template, only raw code from Template?
I wanna it should be like:
<BaseIcon icon="camera" iconColor="white" />
My BaseIcon/index.stories.js code:
import BaseIcon from './index.vue';
import validIcons from './validIconsList';
export default {
title: 'Components/BaseIcon',
component: BaseIcon,
argTypes: {
icon: {
options: validIcons,
control: {
type: 'select'
}
}
},
/* parameters: {
docs: {
source: {
type: 'code'
}
}
} */
};
const Template = (args, { argTypes }) => ({
components: { BaseIcon },
props: Object.keys(argTypes),
template: `<BaseIcon v-bind="$props" />`
});
export const Default = Template.bind({});
Default.args = {
icon: 'camera'
};
Toggling commented parameters property in export default {} does nothing.
What did I miss?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Vue component within code block, Vue attempting to render ...
i'm trying to display example Vue component's within my documentation, however Vue is also recognizing the template within my Vue component.
Read more >Docs source loader doesn't render Vue code correctly. #10163
I have been trying to show code snippets of my Vue components in docs, but due to the limitations of vue in docs,...
Read more >Conditional Rendering - Vue.js
The directive v-if is used to conditionally render a block. The block will only be rendered if the directive's expression returns a truthy...
Read more >Vue conditional rendering: editing existing todos
We are nearing the end of our Vue series now. ... JavaScript objects that manage the app's data and an HTML-based template syntax...
Read more >Vue.js | IntelliJ IDEA Documentation - JetBrains
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style | Vue Template, and open the Tabs and Indents tab....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We experience this behavior for all of our stories too, after upgrading from 6.1.x to 6.3.7. We use Vue 2.6.11.
I just created it. Link: https://github.com/standbyoneself/storybook. It is a monorepo. I also created new Lerna package named
storybook. It is super default vue project created by vue-cli that has storybook. You need to typeyarn storybookand you’ll see that default component`s code also doesn’t look as I want