

这里用文字举例,图片切换的原理也是一样的
大概思路是:用两个class相同的span分别是切换前后的文字,class相同主要是为了变换前后的文字位置相同。然后用click事件控制它们的显隐。
代码如下:
HTML:
<span class="response" v-show="!showCommentInput" @click="showCommentInput = !showCommentInput">回复</span> <span class="response" v-show="showCommentInput" @click="showCommentInput = !showCommentInput">回复</span>
JS:
data(){
return {
showCommentInput = false,
}
}CSS:
.response {
font-size:14px;
color: #3e3e3e;
&:hover{
font-weight: bold;
}
&+.response {
font-weight: bold;
}上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
在Webpack中解决热部署检测不到文件变化的问题
在webpack-dev-server中实现自动更新页面
通过jquery技术实现放大镜
