我有一个app-drawer-layout
元素,在其中,我希望抽屉内容(蓝色)与主要内容(黄色)齐平,它们之间没有间隙(白色)。请注意,我将其从默认更改--app-drawer-width
为。这可能是造成差距的原因。这是一个错误吗?还是我编码错误?100px
256px
这是JSBin。 注意:查看演示时,请确保输出窗格的滑动宽度足以使抽屉可见。如果输出窗格太窄,抽屉将被隐藏。
应用程序抽屉布局 http://jsbin.com/lulenamavo/edit?html,输出<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<base href="http://polygit.org/polymer+:master/components/">
<link rel="import" href="polymer/polymer-element.html">
<link rel="import" href="app-layout/app-layout.html">
</head>
<body>
<dom-module id="my-el">
<template>
<style>
app-drawer {
--app-drawer-width: 100px;
--app-drawer-content-container: {
background-color: blue;
color: white;
}
}
#main-content {
background-color: yellow;
height: 100vh;
width: 100vw; /* doesn't make content sections flush */
}
</style>
<app-drawer-layout fullbleed>
<app-drawer slot="drawer">
drawer content
</app-drawer>
<div id="main-content">
main content
</div>
</app-drawer-layout>
</template>
<script>
class MyEl extends Polymer.Element {
static get is() {
return 'my-el'
}
}
customElements.define(MyEl.is, MyEl);
</script>
</dom-module>
<my-el></my-el>
</body>
</html>