给el-dialog的整体加动态class

需求,按某个按钮让整个el-dialog旋转,再按按钮,转回来,因此需要在整个el-dialog上加一个动态样式

javascript 复制代码
<el-dialog
:class="dynamicClass"
> 
.......
</el-dialog>


<script lang="ts" setup>
import { computed, ref} from 'vue'

let isRotate = ref<boolean>(false) //是否旋转

//横竖屏切换的动态class,使用计算属性
const dynamicClass = computed(() => {
  return isRotate.value ? 'rotateClass' : ''
})

/**
 * 按钮回调
 */
function switchLandscapeScreen() {
  isRotate.value = !isRotate.value   //只需要控制该变量
} 

</script>

<style scoped lang="scss">

:deep(.rotateClass) {
  transform: rotate(-90deg);
}

</style>
相关推荐
mCell1 小时前
前端路由详解:Hash vs History
前端·javascript·vue-router
海上彼尚1 小时前
无需绑卡的海外地图
前端·javascript·vue.js·node.js
1024肥宅1 小时前
手写 call、apply、bind 的实现
前端·javascript·ecmascript 6
科杰智能制造2 小时前
纯前端html、js实现人脸检测和表情检测,可直接在浏览器使用
前端·javascript·html
每天吃饭的羊2 小时前
组件库的有些点击事件是name-click这是如何分装de
前端·javascript·vue.js
Coder-coco2 小时前
个人健康管理|基于springboot+vue+个人健康管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·mysql·论文
x***01062 小时前
SpringSecurity+jwt实现权限认证功能
android·前端·后端
1024肥宅3 小时前
防抖(Debounce)
前端·javascript·ecmascript 6
1024肥宅3 小时前
节流(Throttle)
前端·javascript·ecmascript 6
大怪v3 小时前
【Virtual World 02】两点一线!!!
javascript·css·html