首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将OpenStreetMap添加到我的NUXT应用程序

如何将OpenStreetMap添加到我的NUXT应用程序
EN

Stack Overflow用户
提问于 2019-01-18 17:52:17
回答 1查看 2K关注 0票数 2

我想将OpenStreetMap集成到我的NUXT.js应用程序中。我正在尝试使用this module,但在所有说明之后我看到一个空页面。

我已经在github上创建了an issue,但仍然没有响应。

pages\index.vue

代码语言:javascript
复制
<template>
  <div id="map-wrap" style="height: 100%">
    <no-ssr>
      <l-map :zoom=13 :center="[47.413220, -1.219482]">
        <l-tile-layer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"></l-tile-layer>
        <l-marker :lat-lng="[47.413220, -1.219482]"></l-marker>
      </l-map>
    </no-ssr>
  </div>
</template>

nuxt.config.js

代码语言:javascript
复制
const pkg = require('./package')

module.exports = {
  mode: 'universal',

  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }},
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  /*
  ** Global CSS
  */
  css: [
    'element-ui/lib/theme-chalk/index.css'
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/element-ui'
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios',
    ['nuxt-leaflet', { /* module options */ }]
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
  },

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
}
EN

回答 1

Stack Overflow用户

发布于 2020-03-09 22:13:36

只需更改样式,将宽度设置为===>

Style=“高: 100%;宽:500px”

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54251396

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档