css样式,点击 箭头方向上下转换

实现效果:

点击切换箭头方向

实现代码

html 复制代码
    <div
      class="modelPart"
      @click="showClick"
    >
      <div class="modelPart_left">
        <img
          :src=aidefalutIcon
          class="sNodeIcon"
        >
        <div>{{ selectModel }}</div>
        <div class="chatText">CHAT</div>
      </div>
      <span :class="dropdown==true?'expand':'down'"
           class="arrow"></span>
    </div>
javascript 复制代码
<script setup>
     import { useI18n } from 'vue-i18n';
     const { t } = useI18n();
     import { onMounted, ref, watch } from 'vue'
     const dropdown = ref(false)
     // 点击事件
     function showClick () {
         dropdown.value = !dropdown.value
     }
</script>
css 复制代码
  .arrow {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-top: -3px;
    margin-left: 9px;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
   
  }
  .down{
   transform: rotate(225deg);
   transform-origin: center;
   transition: all 0.3s;
}
  .expand {
    transform: translate(0, 2px) rotate(45deg);
    transform-origin: center;
    transition: all 0.3s;
 }
相关推荐
毕设十刻1 天前
基于Vue的鲜花销售系统33n62(程序 + 源码 + 数据库 + 调试部署 + 开发环境配置),配套论文文档字数达万字以上,文末可获取,系统界面展示置于文末
前端·数据库·vue.js
IT_陈寒1 天前
Spring Boot 3.2震撼发布:5个必知的新特性让你开发效率提升50%
前端·人工智能·后端
初遇你时动了情1 天前
前端使用TensorFlow.js reactjs调用本地模型 实现图像、文本、音频/声音、视频相关识别
前端·javascript·tensorflow
广州华水科技1 天前
单北斗GNSS变形监测系统安装与应用解析,提升位移监测精度
前端
J***Q2921 天前
前端微前端框架原理,qiankun源码分析
前端·前端框架
菜鸟‍1 天前
【前端学习】React学习【万字总结】
前端·学习·react.js
百***84451 天前
Webpack、Vite区别知多少?
前端·webpack·node.js
Mintopia1 天前
零信任架构下的 WebAIGC 服务安全技术升级方向
前端·人工智能·trae
敏姐的后花园1 天前
模考倒计时网页版
java·服务器·前端
AiXed1 天前
PC微信WDA算法
前端·javascript·macos