首页 > 解决方案 > Vue 2 google-map 不会在故事书中呈现

问题描述

我正在使用vue2-google-maps包,并且我有一个工作地图组件。现在我尝试在故事书中为这个组件创建一个故事,但我得到了如下错误:

Unknown custom element <GmapMap>

Unknown custom element <GmapMarker>

Unknown custom element <GmapInfoWindow>.

这是我的故事:


export default {
  title: "Components/GoogleMap",
  component: GoogleMap,
  argTypes: {
    size: {
      options: ["big"],
      control: "radio"
    }
  }
};

const Template = (args, { argTypes }) => ({
  props: Object.keys(argTypes),
  components: { GoogleMap },
  template: `<GoogleMap v-bind="$props" />`
});

export const Big = Template.bind({});
Big.args = {
  size: "big",
  addresses: [...]
};

export const Small = Template.bind({});
Small.args = {
  ...
};

有人对此有任何想法吗?

标签: javascriptvue.jsgoogle-mapsstorybookvue2-google-maps

解决方案


推荐阅读