如何在Ember中将简单的HTML主题与Google地图集成?

时间:2015-07-13 20:19:00

标签: twitter-bootstrap ember.js

我有一些来自某个人Bootply的代码,我已将代码整合到ember中,但它并没有按我想要的方式播放,也不会播放主题。 ember中的滚动条是右侧,而不是左侧div作为示例。

我有一个Brocfile.js文档:

/* global require, module */

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp();

// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.


app.import('vendor/css/bootstrap.min.css');
app.import('vendor/css/styles.css');
app.import('vendor/js/bootstrap.min.js');
app.import('vendor/js/scripts.js');

module.exports = app.toTree();

我有index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>TestMap</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {{content-for 'head'}}

    <link rel="stylesheet" href="assets/vendor.css">
    <link rel="stylesheet" href="assets/test-map.css">

    {{content-for 'head-footer'}}
  </head>
  <body>
    {{content-for 'body'}}

    <script src="assets/vendor.js"></script>
    <script src="assets/test-map.js"></script>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>

    <script src="http://maps.googleapis.com/maps/api/js?sensor=false&extension=.js&output=embed"></script>

    {{content-for 'body-footer'}}
  </body>
</html>

有关于此的任何建议吗?我还会附上一些截图: enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

Ember将您的应用程序包装在div中。这里的问题是我们无法在不使用已弃用的Ember.View的情况下为该div添加一个类。

暂时你可以通过在身体上使用直接子选择器来解决这个问题:

body > div {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

这将删除右滚动条。