我正在尝试创建一个可滚动的 flex-child ,其高度由其 flex-grow 属性决定。
例子:
.container {
display: flex;
flex-direction: column;
height: 100%;
}
.heading {
background: #9D8189;
flex: 0 0 auto;
padding: 2rem;
min-height: 10rem;
}
.content {
background: #FFE5D9;
flex: 1 0 auto;
padding: 2rem;
/* Makes it scrollable but breaks the flexbox layout */
max-height: 40vh;
overflow: scroll;
}
.box {
background: #D8E2DC;
padding: 7rem;
}Run Code Online (Sandbox Code Playgroud)
<body>
<div class="container">
<div class="heading">heading</div>
<div class="content">
<div class="box">box1</div>
<div class="box">box2</div>
<div class="box">box3</div>
</div>
</div>
</body>Run Code Online (Sandbox Code Playgroud)
(jsfiddle)
该布局由 …
我有一个嵌套的结构.我想在方法中更新它.出于某种原因,更新不会发生.
package main
import "fmt"
type B struct {
c int
}
type A struct {
b B
}
func (a A) updateB(n int) {
a.b.c = n
}
func main() {
a := A{b: B{c: 5}}
fmt.Println(a)
a.updateB(42)
fmt.Println(a)
}
Run Code Online (Sandbox Code Playgroud)
我得到的输出是
{{5}}
{{5}}
Run Code Online (Sandbox Code Playgroud)
在大多数语言中,我希望它会更新.这是一些特殊的Go行为吗?如何在Go中更新嵌套结构?
在使用 Tailwind 和实用程序优先的 css 方法时,我经常发现需要将多个类绑定到单个变量。
例如,要设置输入表单的样式,如果出现错误,我需要添加border-red、等。color-red
在 Vue 中是否有一种漂亮而优雅的方式来表达这一点而不是编写v-bind:class="{ 'border-red': error, 'text-red': error }?