当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vue.storiesOf函数代码示例

本文整理汇总了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:    {
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueCheckbox.stories.ts

示例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 />`,
}));
开发者ID:trungx,项目名称:vue-starter,代码行数:12,代码来源:VueFooter.stories.ts

示例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/>
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueTruncate.stories.ts

示例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">
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueTabGroup.stories.ts

示例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
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueAccordion.stories.ts

示例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'),
  },
}));
开发者ID:trungx,项目名称:vue-starter,代码行数:21,代码来源:VuePagination.stories.ts

示例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,
      );
    },
  },
}));
开发者ID:trungx,项目名称:vue-starter,代码行数:30,代码来源:VueNotificationStack.stories.ts

示例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)
);
开发者ID:wonderful-panda,项目名称:vue-vlist,代码行数:13,代码来源:index.ts

示例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 {
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueDataTable.stories.ts

示例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>
开发者ID:trungx,项目名称:vue-starter,代码行数:31,代码来源:VueCollapse.stories.ts


注:本文中的@storybook/vue.storiesOf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。