【发布时间】:2020-10-09 04:00:43
【问题描述】:
我正在尝试在屏幕的右上角水平显示导航控件。下面的工作和显示在一行中的每个项目:
<template>
<div id="navControlPanel">
<div id="controls">
<NavControl />
<NavControl />
<NavControl />
</div>
</div>
</template>
<style>
#navControlPanel{
display: flex;
flex-direction: row;
width: 100px;
height: 50px;
background: purple;
}
#controls{
display: flex;
flex-direction: row;
width: 100%;
}
</style>
但这不是,而是与它们一起显示在一个列中:
<template>
<div id="navControlPanel">
<div id="controls" v-bind:key="control.id" v-for="control in controls">
<NavControl v-bind:control="control" />
</div>
</div>
</template>
导航控制:
<template>
<div id="navControl">
{{control.id}} //Set to just plain text when not dynamically binded
</div>
</template>
<style scoped>
#navControl{
width: 30pt;
height: 30pt;
background: blue;
border-radius: 1000px;
}
</style>
我找不到任何不同的合乎逻辑的原因,除非这是我所缺少的 Vue 工作的某种固有方式。
【问题讨论】:
标签: javascript html css vue.js flexbox