当前位置: 首页 > news >正文

松江品划网站建设推广锦州市城市建设服务中心网站

松江品划网站建设推广,锦州市城市建设服务中心网站,衡水企业做网站多少钱,如何建立自己的网站教程组件效果图 未达到最大高度 达到设置的最大高度 进行展开 实现代码 组件代码 备注#xff1a;通过tailwindcss设置的样式#xff0c;通过element-plus/icons-vue设置的图标#xff0c;可根据情况进行替换 template!-- 限制高度组件 --div ref…组件效果图 未达到最大高度 达到设置的最大高度 进行展开 实现代码 组件代码 备注通过tailwindcss设置的样式通过element-plus/icons-vue设置的图标可根据情况进行替换 template!-- 限制高度组件 --div refrestrictionBox classrelative overflow-hidden bg-blue-300 :classcontrol.isUnfold ? : maxdiv refrestrictionChilslot/slot/div!-- 渐变 --div v-ifcontrol.isExceed !control.isUnfold classabsolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-white/div/div!-- 控制按钮 --div v-ifcontrol.isExceeddiv classflex h-12 cursor-pointer select-none items-center justify-center space-x-1 pb-2 text-blue-500 active:text-blue-400 clickchangeUnfoldspan classtext-sm{{ control.isUnfold ? 收起 : 展开 }}/spanel-iconArrowUp v-ifcontrol.isUnfold /ArrowDown v-else //el-icon/div/div /templatescript setup import { ref, reactive, onMounted, onUnmounted } from vue import { ArrowUp, ArrowDown } from element-plus/icons-vue// 接收参数 const props defineProps({// 最大高度 - 收起前max: {type: String,default: max-h-48} })// 组件控制参数 const control reactive({boxHeight: 0,chilHeight: 0,isExceed: false, // 是否超出高度isUnfold: false // 是否展开 })// 改变展开方式 const changeUnfold () (control.isUnfold !control.isUnfold)// 获取元素 const restrictionBox ref(null) const restrictionChil ref(null)// 创建高度监听 及监听销毁 let observerBox null let observerChil null// 销毁监听 const destroyedObserver () {if (observerBox) {observerBox.disconnect()observerBox null}if (observerChil) {observerChil.disconnect()observerChil null} }// 比较高度的函数 const compareHeights () {if (control.boxHeight 0 control.chilHeight 0) {// 高度超出,出现下拉if (control.chilHeight control.boxHeight) {destroyedObserver()console.log(超出高度)control.isExceed true}} }// 页面加载完成 onMounted(() {// 父级监听observerBox new ResizeObserver(entries {entries.forEach(entry {control.boxHeight entry.contentRect.heightcompareHeights()})})// 内容监听observerChil new ResizeObserver(entries {entries.forEach(entry {control.chilHeight entry.contentRect.heightcompareHeights()})})// 开始监听两个元素observerBox.observe(restrictionBox.value)observerChil.observe(restrictionChil.value) }) onUnmounted(() {destroyedObserver() }) /script外层引用 script setup import HeightRestriction from ../../components/HeightRestriction/HeightRestriction.vueconst ttt1 ref(0) const tttt () {ttt1.value } /scripttemplateHeightRestrictionbutton clicktttt测试/buttondiv v-fori in ttt1 :keyi{{ ttt1ttt1ttt1 }}/div/HeightRestriction /template
http://www.w-s-a.com/news/858763/

相关文章:

  • 网站301做排名python做的网站如何部署
  • 昆山做企业网站工信部网站 备案
  • 做英文的小说网站有哪些网站做qq登录
  • 湖州建设局招投标网站深圳广告公司集中在哪里
  • 重庆主城推广网站建设商城网站建设预算
  • 宁波品牌网站推广优化公司开发公司工程部工作总结
  • 长沙建站模板微信网站建设方案
  • 不让网站在手机怎么做门户网站 模板之家
  • 网站建设及推广图片wordpress文章摘要调用
  • 手机版网站案例全国信息企业公示系统
  • 模仿别人网站建设银行广州招聘网站
  • 沧州网站建设沧州内页优化
  • 代加工网站有哪些专门做网站关键词排名
  • 郑州做景区网站建设公司软件开发者模式怎么打开
  • 长沙企业网站建设哪家好做app一般多少钱
  • 南宁一站网网络技术有限公司网站开发技术应用领域
  • 公司网站建设方案ppt专业构建网站的公司
  • 深圳网站建设方维网络网站框架设计好后怎么做
  • 合肥网站建设过程网站栏目建设调研
  • 手机访问网站页面丢失北京电商平台网站建设
  • 郑州网站怎么推广中山 网站关键词优化
  • 国外试用网站空间网站建设与管理题目
  • 淄博网赢网站建设网站设计的技术选择
  • 建外贸网站 东莞厦门做网站最好的公司
  • 为您服务网站新网站做百度推广
  • 电子商务免费网站建设网站制作哪个好薇
  • 全面启动门户网站建设中小型企业建设一个网站大概需要多少钱
  • 建网站一般多少钱网站建设上传服务器步骤
  • 手机销售网站怎么做的网站推广优化建设方案
  • 做任务分享赚钱的网站德阳网站建设公司哪家好