老师,这章视频CSSTransition位置直接在NavSearch上写一个transition不好吗?
来源:7-5 搜索框动画效果实现
wxhzz
2018-07-27
export const NavSearch = styled.input.attrs({
type: 'text', placeholder: '搜索'
})`
width: 240px;
height: 38px;
border: none;
border-radius: 19px;
background: #eee;
padding: 0 40px 0 20px;
box-sizing: border-box;
margin-top: 9px;
outline: none;
transition: all 0.2s ease-out;
&::placeholder {
color: #999;
}
&.focused {
width: 320px;
}
`;像老师这样写感觉好麻烦,这样写感觉可以省去使用CSSTransition,还是使用react-transition-group对性能有所提升吗?
写回答
1回答
-
Dell
2018-07-27
是这样的,简单动画cssTransition足够了,但是复杂动画,就得使用react-transition-group了,我这主要是给介绍下这个模块
00
相似问题