码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 基于Vue2.0对Tinymce Editor富文本编辑器进行封装与使用


    前言

    这是一个展开和收起的小功能,可用于查看文章时点击展开和点击收起。

    一、示例代码

    (1)/src/views/Example/ExpandToggle/index.vue

    1. <script setup lang="ts">
    2. import { onMounted, ref } from "vue";
    3. import { ArrowUp, ArrowDown } from "@element-plus/icons-vue";
    4. const ewRef = ref(); // 实例
    5. const isExpand = ref(false); // 是否展开
    6. onMounted(() => {
    7. console.log('ewRef =>', ewRef)
    8. if (ewRef.value) {
    9. if (ewRef.value.scrollHeight > ewRef.value.clientHeight) {
    10. // ...
    11. }
    12. }
    13. });
    14. script>
    15. <style lang="less" scoped>
    16. .e-w {
    17. width: auto;
    18. padding: 100px;
    19. .e-w-main {
    20. height: 150px;
    21. overflow: hidden;
    22. position: relative;
    23. border: 1px solid #ddd;
    24. &.e-w-expand {
    25. height: auto;
    26. overflow: hidden;
    27. }
    28. // ---- ---- ---- ---- ^ 展开 样式 ---- ---- ---- ----
    29. .view-more {
    30. width: 100%;
    31. height: 22px;
    32. padding-top: 60px;
    33. background-image: linear-gradient(
    34. -180deg,
    35. rgba(255, 255, 255, 0) 0%,
    36. #ebebebf6 100%
    37. );
    38. position: absolute;
    39. bottom: 0;
    40. .view-more-box {
    41. width: 44px;
    42. height: 22px;
    43. background-color: rgba(255, 255, 255, 1);
    44. border-top-left-radius: 8px;
    45. border-top-right-radius: 8px;
    46. position: absolute;
    47. display: block;
    48. margin: auto;
    49. left: 0;
    50. right: 0;
    51. bottom: 0;
    52. cursor: pointer;
    53. .el-icon {
    54. position: absolute;
    55. display: block;
    56. margin: auto;
    57. left: 0;
    58. right: 0;
    59. bottom: 0;
    60. }
    61. }
    62. }
    63. // ---- ---- ---- ---- / 展开 样式 ---- ---- ---- ----
    64. // ---- ---- ---- ---- ^ 收起 样式 ---- ---- ---- ----
    65. .has-more {
    66. width: 100%;
    67. height: 22px;
    68. position: absolute;
    69. bottom: 0;
    70. .has-more-box {
    71. width: 44px;
    72. height: 22px;
    73. background-color: rgba(255, 255, 255, 1);
    74. border-top-left-radius: 8px;
    75. border-top-right-radius: 8px;
    76. position: absolute;
    77. display: block;
    78. margin: auto;
    79. left: 0;
    80. right: 0;
    81. bottom: 0;
    82. cursor: pointer;
    83. .el-icon {
    84. position: absolute;
    85. display: block;
    86. margin: auto;
    87. left: 0;
    88. right: 0;
    89. bottom: 0;
    90. }
    91. }
    92. }
    93. // ---- ---- ---- ---- / 收起 样式 ---- ---- ---- ----
    94. }
    95. }
    96. style>

    二、运行效果

  • 相关阅读:
    “判断性别”Demo需求分析和初步设计(中)
    FreeRTOS学习笔记-任务通知
    imx6ull移植openwrt
    基于微信小程序的学院通知与文件分享系统app设计与实现-计算机毕业设计源码+LW文档
    Pantera联创:读懂想做web3版Discord的加密原生聊天协议Comm
    18uec++多人游戏【服务器为两个角色发枪,并能在线开枪】
    《向经典致敬》第二届粤港澳大湾区著名歌唱家音乐会完美落幕
    【HCIE】15.OSPFV3
    pbootcms 后台内容列表搜索功能扩展及增加显示字段功能
    在企业微信里面添加h5页面 进行登录授权
  • 原文地址:https://blog.csdn.net/Cai181191/article/details/127755124
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号