span 文字宽度自动换行/超出部分自定义行数...显示

博客探讨了如何通过将信号长度划分为小段,并利用小段信号长度除以采样频率的方法来获取精确的小段时间信息。这种方法适用于需要对短时间内发生的变化进行精确分析的场景。
style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;"
<div class="" style="margin-top:10px;background: #fff;">
                    <span style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;">{{indexData.result}}</span>
                  </div>

效果:
在这里插入图片描述
超出部分…显示:想要第几行显示…都可以

设置:-webkit-line-clamp: 5;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .over {
            font-weight: bold;
            color: #000;
            font-size: 12px;
            text-overflow: ellipsis;
            -o-text-overflow: ellipsis;
            width: 240px;
            display: block;
            overflow: hidden;

            display: -webkit-box;
            -webkit-line-clamp: 5;
            -webkit-box-orient: vertical;
        }
    </style>
</head>
<body>
    <div style="background: rgb(211, 144, 144);margin-top: 200px;height: 200px ;width: 500px;">

        <div style="background: rgb(128, 199, 158);">
            <span class="over">若想得到小段时间可以考虑把信号长度进行划分,再用小段信号长度/采样频率,即把时间微分若想得到小段时间可以考虑把信号长度进行划分,再用小段信号长度/采样频率,即把时间微分若想得到小段时间可以考虑把信号长度进行划分,再用小段信号长度/采样频率,即把时间微分若想得到小段时间可以考虑把信号长度进行划分,再用小段信号长度/采样频率,即把时间微分</span>
        </div>
    </div>
</body>
</html>

展示效果:
在这里插入图片描述

<!-- * @Description: 海淀智慧物业平台app-通知公告 --> <template> <div class="notify_content" style="padding: 0;"> <!-- <img class="icon_img" :src="require(&#39;@/assets/img/dashboard/icon_tongzhi.png&#39;)" alt="" /> --> <div class="notice_head"> <div class="tzgg"> <img src="@/assets/img/dashboard/lingdang.png" width="20px" alt=""> 通知公告1</div> <p @click="showNoticeList">更多 <a-icon type="right" /></p> </div> <van-notice-bar v-if="showUnreadModal" color="#faad14" background="#ff4d4f" class="custom-notice-bar" > <div class="leftCenterRight"> <img src="@/assets/img/image 1300.png" class="left"> <span class="modal-text">您有{{ unreadNoticeCount }}条新的通知,请查阅。</span> <van-icon name="close" class="notice-close-icon" @click="handleModalOk" /> <img src="@/assets/img/Group 1321322159.png" @click="handleModalOk" class="right"> <van-icon name="close" class="notice-close-icon" @click="handleModalOk" /> </div> </van-notice-bar> <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> <div v-for="(item, i) of list" :key="i" class="notify_content_item" :class="{ unread: i < unreadNoticeCount }" @click="notifyGoPage(item)"> <div> <p class="title">{{ item.noticeName }}</p> <p class="content ellipsis" v-html="formatNoticeContent(item.noticeContent)"></p> <van-divider v-if="i < list.length - 1" /> </div> <img src="item.src" alt="" v-if="false" /> </div> </van-list> </van-pull-refresh> </div> </template> <script> import rolemixins from &#39;@/utils/rolemixins&#39;; import { loginTest, queryNoticePublishPageList, ygNoticeList, selectNoticeList, selectNoticeCount } from &#39;@/api/home&#39;; export default { name: &#39;notifyContent&#39;, mixins: [rolemixins], data() { return { showUnreadModal: false, unreadNotice: null, unreadNoticeCount: 1, // 新增字段:未读通知数量 pathStr: this.$route.path, pathName: this.$route.meta.title ? this.$route.meta.title : &#39;&#39;, query: { pageNo: 1, // 分页 pageSize: 10 // 每页个数 }, loading: false, finished: false, refreshing: false, list: [] }; }, created() { this.selectNoticeList(); this.checkUnreadNotice(); }, activated() { }, mounted() { // this.onRefresh() }, methods: { formatNoticeContent(content) { return content.replace(/font-size:\s*[^;]+;?/gi, &#39;font-size:13.76px;&#39;); }, // 更多按钮跳转至公告列表 showNoticeList() { this.$router.push(&#39;/noticeListAll&#39;); }, //查询公告列表页 // selectNoticeList() { // this.query.userId = JSON.parse(localStorage.getItem(&#39;userInfo&#39;)).id; // selectNoticeList(this.query).then((res) => { // if (res.success && undefined != res.result) { // this.list = res.result.records.slice(0, 3); // } else { // this.list = [{ // noticeName: &#39;暂无公告&#39;, // noticeContent: &#39;暂无公告&#39; // }]; // } // }); // }, // 查询通知列表 selectNoticeList() { const userId = JSON.parse(localStorage.getItem(&#39;userInfo&#39;)).id; this.query.userId = userId; selectNoticeList(this.query).then(res => { if (res.success && res.result?.records) { this.list = res.result.records.slice(0, 3); } else { this.list = [{ noticeName: &#39;暂无公告&#39;, noticeContent: &#39;暂无公告&#39; }]; } }); }, // 检查是否有未读通知 checkUnreadNotice() { const userId = JSON.parse(localStorage.getItem(&#39;userInfo&#39;)).id; selectNoticeCount({ userId }).then(res => { if (res.success && res.result > 0) { this.unreadNoticeCount = res.result this.showUnreadModal = true; } }); }, // 弹窗确认后跳转详情页 handleModalOk() { this.showUnreadModal = false; // const userId = JSON.parse(localStorage.getItem(&#39;userInfo&#39;)).id; // selectNoticeList({ userId, isRead: false }).then(res => { // if (res.success && res.result.records.length > 0) { // const firstUnread = res.result.records[0]; // this.$router.push({ // path: &#39;/issueNoticeDetail&#39;, // query: { // projectId: firstUnread.projectId, // id: firstUnread.id, // item: item // } // }); // } // }); }, ygNoticeList() { var param = { pageNo: this.query.pageNo, pageSize: this.query.pageSize }; ygNoticeList(param).then((res) => { if (res.success) { this.list = res.result.records; } else { this.list = []; } }); }, onLoad() { if (this.refreshing) { this.list = []; this.refreshing = false; } this.loading = true; this.query.pageNo++; this.getList(); }, onRefresh() { this.query.pageNo = 0; //起始为第一页 this.list = []; this.refreshing = true; this.finished = false; //加载与不加载的状态 setTimeout(() => { this.loading = true; //下拉刷新状态 this.onLoad(); //刷新成功调用列表方法 this.loading = false; }, 1000); }, getList() { this.loading = false; let data = Object.assign({}, this.query); selectNoticeList(data).then(res => { if (res.success) { this.list = [...this.list, ...res.result.records]; this.loading = false; if (this.list.length >= res.result.total) { this.finished = true; } } }); // queryCollectDataList(data).then(res => { // if (res) { // this.total = res.result.total; // res.result.records.map(item => { // this.list.push(item); // }); // this.loading = false; // if (this.list.length >= res.result.total) { // this.finished = true; // } // } // }); }, notifyGoPage(item) { this.$router.push({ path: &#39;/issueNoticeDetail&#39;, query: { projectId: item.projectId, id: item.id, item: item } }); }, goPage() { } } }; </script> <style scoped lang="less"> @import &#39;@/assets/css/comm.less&#39;; @bg-color: #ff4d4f; // 红色背景 @text-color: white; @icon-size: 40px; // 图标大小 @close-icon-size: 14.16px; // 关闭图标大小 @close-margin-right: 20px; // 右边距 .notify_content { width: 350px; min-height: 198px; margin: 10px auto; background: #fff; border-radius: 7px 7px 25px 7px; position: relative; overflow-y: auto; // 自定义 van-notice-bar 样式 .custom-notice-bar { border-radius: 20px; width: 350px; height: 24px; position: fixed; top: 156px; .leftCenterRight{ display: flex; justify-content: center; align-items: center; text-align: center; .left{ margin-left: 23px; margin-right: 21px; } .right{ margin-left: 103px; } } .modal-text { line-height: @icon-size + 25px; font-size: 12px; color: @text-color; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .notice-close-icon { background-color: #FF920A !important; width: @close-icon-size; height: @close-icon-size; font-size: @close-icon-size; margin-left: 125px; margin-right: @close-margin-right; color: @text-color; cursor: pointer; line-height: @icon-size + 25px; } img{ width: 14.16px; height: 14.16px; } } .custom-modal{ background-color: red; } .notice_head { display: flex; justify-content: space-between; align-items: center; border-bottom: #E3E3E3 1px solid; padding: 12px; .tzgg { color: #000000; font-family: "PingFang SC"; font-size: 15px; font-style: normal; font-weight: 700; line-height: normal; } p { color: #3b77b3; font-size: 14px; font-weight: 600; } } .modal-content { font-size: 16px; color: #333; text-align: center; } .icon_img { position: absolute; top: 1px; right: 10px; width: 35px; } .notify_content_item { height: 81.95px; display: flex; padding-left: 12px; margin: 10px; border-radius: 12px; border: 1px solid #def0fe; background: linear-gradient(to right, #eaf6ff, #ffffff); >div { // width: calc(100% - 100px); width: calc(100% - 20px); padding-right: 15px; p { margin: 10px 0; } .van-divider { border:none } p.title { font-family: PingFangSC, PingFang SC; font-weight: 600; font-size: 15px; color: #000000; } p.content { font-family: PingFangSC, PingFang SC; font-weight: 400; font-size: 12px; color: #666666; } } &.unread { background: linear-gradient(260deg, #FFF 5.08%, #FCE4E9 90.46%); border-color: #ff4d4f; .content { color: #F88600; } } img { width: 100px; height: 60px; margin-bottom: 10px; } } } </style> <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> <div v-for="(item, i) of list" :key="i" class="notify_content_item" :class="{ unread: i < unreadNoticeCount }" @click="notifyGoPage(item)"> <div> <p class="title">{{ item.noticeName }}</p> <p class="content ellipsis" v-html="formatNoticeContent(item.noticeContent)"></p> <van-divider v-if="i < list.length - 1" /> </div> <img src="item.src" alt="" v-if="false" /> </div> </van-list> </van-pull-refresh> 字体超出列表大小显示省略号
08-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我先来一碗

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值