本文整理匯總了TypeScript中@storybook/vue.storiesOf函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript storiesOf函數的具體用法?TypeScript storiesOf怎麽用?TypeScript storiesOf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了storiesOf函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: data
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueCheckbox from './VueCheckbox.vue';
import { action } from '@storybook/addon-actions';
const story = (storiesOf('VueCheckbox', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Checkbox', () => ({
components: { VueCheckbox },
data() {
return {
model: false,
};
},
template: `<vue-checkbox label="checkbox" name="checkbox" id="checkbox" @click="action" v-model="model" />`,
methods: {
action: action('@onClick'),
},
}));
story.add('Checkbox Disabled', () => ({
components: { VueCheckbox },
data() {
return {
model: false,
};
},
template: `<vue-checkbox label="checkbox" name="checkbox" id="checkbox" disabled @click="action" v-model="model" />`,
methods: {
示例2:
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueFooter from './VueFooter.vue';
const story = (storiesOf('VueFooter', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
components: { VueFooter },
template: `<vue-footer />`,
}));
示例3:
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueTruncate from './VueTruncate.vue';
import { i18n } from '../../plugins/i18n/i18n';
const story = (storiesOf('VueTruncate', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
i18n,
components: { VueTruncate },
template: `<vue-truncate>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et<br/>
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet<br/>
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,<br/>
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,<br/>
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,<br/>
no sea takimata sanctus est Lorem ipsum dolor sit amet.
</vue-truncate>`,
}));
story.add('Without truncation', () => ({
i18n,
components: { VueTruncate },
template: `<vue-truncate :lines="6">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et<br/>
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet<br/>
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,<br/>
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,<br/>
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,<br/>
示例4:
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueTabGroup from './VueTabGroup.vue';
import VueTabItem from './VueTabItem/VueTabItem.vue';
const story = (storiesOf('VueTabGroup', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
components: {
VueTabGroup,
VueTabItem,
},
template: `
<vue-tab-group>
<vue-tab-item title="Profile" icon="fas fa-user">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</vue-tab-item>
<vue-tab-item title="Settings" icon="fas fa-cog">
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</vue-tab-item>
<vue-tab-item title="Upload" icon="fas fa-upload">
示例5:
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueAccordion from './VueAccordion.vue';
import VueAccordionItem from './VueAccordionItem/VueAccordionItem.vue';
const story = (storiesOf('VueAccordion', module) as any);
story.addDecorator(VueInfoAddon);
const storySchema = [
{
label: 'Default',
},
{
label: 'Multiple',
props: ['multiple'],
},
];
for (const item of storySchema) {
story.add(item.label, () => ({
components: {
VueAccordion,
VueAccordionItem,
},
template: `<vue-accordion ${item.props ? item.props.join(' ') : ''}>
<vue-accordion-item title="Item 1" :initOpen="true">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
示例6: data
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VuePagination from './VuePagination.vue';
import { action } from '@storybook/addon-actions';
const story = (storiesOf('VuePagination', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
components: { VuePagination },
data() {
return {
page: 1,
};
},
template: `<vue-pagination :pages="10 " :current="page" @change="action($event);page=$event" />`,
methods: {
action: action('@change'),
},
}));
示例7: addNotificationClick
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueNotificationStack from './VueNotificationStack.vue';
import VueButton from '../VueButton/VueButton.vue';
import VuePanel from '../VuePanel/VuePanel.vue';
import { addNotification, INotification } from './utils';
const story = (storiesOf('VueNotificationStack', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
components: { VueNotificationStack, VueButton, VuePanel },
template: `
<vue-panel>
<vue-notification-stack />
<vue-button accent @click="addNotificationClick">add notification</vue-button>
</vue-panel>
`,
methods: {
addNotificationClick() {
addNotification(
{
title: 'this is a test',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod',
} as INotification,
);
},
},
}));
示例8: storiesOf
import { storiesOf } from "@storybook/vue";
import { withInfo } from "storybook-addon-vue-info";
import { VtableExample } from "./VtableExample";
import { VtreetableExample } from "./VtreetableExample";
storiesOf("Vtable", module).add(
"Example",
withInfo({ propTables: ["vtable"] })(() => VtableExample)
);
storiesOf("Vtreetable", module).add(
"Example",
withInfo({ propTables: ["vtreetable"] })(() => VtreetableExample)
);
示例9: data
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import { action } from '@storybook/addon-actions';
import VueDataTable from './VueDataTable.vue';
import { i18n } from '../../plugins/i18n/i18n';
import { dataTableDataFixture, dataTableHeaderFixture } from './DataTableFixtures';
const story = (storiesOf('VueDataTable', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
i18n,
components: { VueDataTable },
data() {
return {
header: dataTableHeaderFixture,
data: dataTableDataFixture,
};
},
template: `<vue-data-table :header="header" :data="data" placeholder="Search" @click="action" />`,
methods: {
action: action('@onClick'),
},
}));
story.add('All Props', () => ({
i18n,
components: { VueDataTable },
data() {
return {
示例10: data
import { storiesOf } from '@storybook/vue';
import VueInfoAddon from 'storybook-addon-vue-info';
import VueCollapse from './VueCollapse.vue';
import VueButton from '../VueButton/VueButton.vue';
import VuePanel from '../VuePanel/VuePanel.vue';
const story = (storiesOf('VueCollapse', module) as any);
story.addDecorator(VueInfoAddon);
story.add('Default', () => ({
components: { VueCollapse, VueButton, VuePanel },
data() {
return {
show: true,
};
},
template: `
<vue-panel>
<vue-button @click="show = !show" accent>Collapse toggle</vue-button>
<br />
<br />
<vue-collapse :show="show">
<div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div>