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

宿州科技网站建设一站式网站管家

宿州科技网站建设,一站式网站管家,昆山建设网站公司,深圳做网站500元一、代码组件 注意#xff1a;当公告字数很少时会固定不动#xff0c;当字数达到最大宽度时#xff0c;则会循环播报 templatediv classTopCard!-- 小喇叭 --div stylewidth: 70pxnotify stylewidth: 2…一、代码组件 注意当公告字数很少时会固定不动当字数达到最大宽度时则会循环播报 templatediv classTopCard!-- 小喇叭 --div stylewidth: 70pxnotify stylewidth: 20px;height: 20px;margin-top: 5px//div!-- 滚动文字外层div文字能展示的区域--div classnoticeBox :stylewidth:noticeWidthpx;height:20px;position:relative;overflow:hidden;display:inline-block;vertical-align:middle;!-- 滚动divmarginLeft变化--div :stylemargin-left:marginLeftpx;white-space:nowrapspan classshowNotice{{showNotice}}/span!-- 不会展示用来测量第二条与第一条重合时的长度 --span classnotice{{notice}}/span/div/div/div /templatescriptimport notify from ../assets/icon/notify.svgexport default {name: Home,components:{notify},props:{noticeData:{type:Array,default:[]}},data () {return {// 适应屏幕分辨率noticeWidth: window.screen.width - 150,// 公告展示过长时会重复两遍showNotice: ,// 用于公告过长时获取重复两遍中第一遍的长度notice: ,// 公告初始位置marginLeft: 150}},mounted () {this.noticeData.forEach((val, index) {if (index 0) {this.showNotice 【 (index 1) 】 val} else {this.showNotice \xa0\xa0\xa0\xa0\xa0\xa0【 (index 1) 】 val}})// 公告上面先赋值再获取宽度setTimeout(() {// 公告div长度var oneNoticeWidth document.getElementsByClassName(showNotice)[0].offsetWidth// 公告外层div长度var noticeBoxWidth document.getElementsByClassName(noticeBox)[0].offsetWidth// 一条公告长度太大时才滚动if (oneNoticeWidth noticeBoxWidth) {// 滚动公告需要将公告重复两遍进行滚动两遍中间需要加空格this.notice this.showNotice \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0// 上面先赋值再获取宽度setTimeout(() {// 获取一遍加中间空格的长度即左移时第二遍与第一遍完全重合时的长度var oneNoticeAddEmptyWidth document.getElementsByClassName(notice)[0].offsetWidth// 公告内容重复两遍this.showNotice this.notice this.showNoticethis.timer setInterval(() {this.marginLeft - 1// 第二遍与第一遍起始位置重合时第一条已完全移到左侧隐藏marginLeft置0即回到第一条if (this.marginLeft (-1) * oneNoticeAddEmptyWidth) {this.marginLeft 0}}, 20)}, 10)} else { //公告并没有很长时不滚动this.marginLeft 0}}, 10)},} /scriptstyle scoped /* 公告card */.TopCard .el-card__body{padding:0 10px}/* 公告title */.tips{color:#606266;font-weight:bold}.TopCard{display: flex;flex-direction: row;align-items: center;} /style二、使用 templatediv div classheaders-middle Notice v-ifthis.noticeData.length0 :noticeDatanoticeData//div/div /templatescriptimport Notice from ../Notice;export default {data() {return {noticeData: [],}},components: {Notice,},methods: {broadcastContent(){//获取后端的公告数据service.get(/users/config/notice).then(res{console.log(res)if (res.code20000){if (res.message!null){this.setNoticeData(res.message)}}})},setNoticeData(notice){if (this.noticeData!null this.noticeData.length!0){this.noticeData[0] notice}else {this.noticeData [];this.noticeData.push(notice)}}},mounted() {this.broadcastContent();}} /scriptstyle scoped.headers-middle{position: absolute;left: 300px;top: 10px;width: 45%;} /style三、效果图循环播报 图一 图二
http://www.pierceye.com/news/932550/

相关文章:

  • 网站开发模块学些什么郑州网站建设动态
  • 各类设计型网站wordpress 防注入
  • 网站中有一个非常著名的原则如何与老板谈网站建设
  • 免费十八种禁用网站如何做一个网页布局
  • cms仿站pc网站案例
  • dede如何做手机网站哪些客户需要做网站
  • 阜蒙县建设镇官方网站那种网站2021
  • 同信.长春网站建设北京网站建设策划
  • 长沙游戏网站开发开发人员公众号
  • 用手机能建网站吗软件商店软件下载
  • 天津自助建站哪个建设网站
  • 西宁市网站建设公司推荐网站全网建设 莱芜
  • 安徽阜阳网站建设公司wordpress网页自适应屏幕大小
  • 上海门户网站的亮点网站开发平台及常用的开发工具
  • 广州h5设计网站公司网站建设从建立服务器开始
  • 如何网站建设全包12306网站多钱做的
  • 阳江北京网站建设中国平面设计在线
  • 上海城乡建设中级职称报名网站合肥网站建设之4个细节要注意事项
  • 洮南网站建设哪家好鞍山信息港招聘信息网
  • 大气手机网站wordpress 添加设置
  • 公司创建网站销售wordpress缩略图支持外链图
  • php网站开发案例教程 dvdwordpress淘宝客自适应模板
  • 做建筑设计网站可以推广的网站有哪些
  • 安徽省建设厅证书查询官方网站关键词优化公司如何选择
  • io游戏网站青岛网站优化排名
  • 怎样建设网站?(怎样注册域名?如何选择主机?网站应有哪些功能模块网站备案可以变更吗
  • 欧美男女直接做的视频网站广告投放跟网站建设一样吗
  • 建网站的流程费用广州比较大的外贸公司
  • wordpress 调用站外api广州优化公司推广
  • 自贡建设专业网站设计企业网站建设专家