word-break:break-all、word-break:break-work和work-wrap:break-work的区别

本文深入探讨了Word Break的概念及其在网页布局中的自动换行机制,包括break-all和break-word两种模式的区别,并详细解释了如何在实际项目中应用这些技术以优化用户体验。
部署运行你感兴趣的模型镜像

word-break:break-all是自动换行。当一个单词到达边界时,下个字母会自动到下一行。

word-break:break-work也是自动换行。将整个单词看成一个整体,如果该行末端宽度不够显示整个单词时,会自动把整个单词放到下一行,而不会把单词截断。

work-wrap:break-work应用效果和word-break:break-work一样。

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

<scroll-view type="custom" scroll-y> <view v-for="item in list" :key="item.id"> <view class="list_work_orders"> <!-- 左边图片 --> <view class="list_image"> <image src="/static/logo.png" class="list_image_size"></image> <!-- <image :src="item.images" class="list_image_size"></image> --> </view> <!-- 右边信息区域,垂直排列 --> <view class="list_info"> <!-- 故障信息 --> <view> <text class="list_info_text">故障:{{ item.description }}</text> </view> <!-- 状态信息 --> <view> <text class="list_info_text">状态:{{ item.status }}</text> </view> <view> <text class="list_info_text">时间:{{ timeString(item.createTime) }}</text> </view> </view> </view> </view> </scroll-view>.container { display: flex; /* 将元素设置为弹性布局 */ flex-direction: column; /* 设置主轴方向为垂直方向 */ } .list_work_orders { background-color: antiquewhite; width: 92%; height: 280rpx; margin: 20rpx 20rpx; display: flex; flex-direction: row; /* 设置主轴方向为水平方向 */ align-items: center; /* 项目在交叉轴上居中 */ border-radius: 20rpx; } .list_image { margin-left: 20rpx; } .list_image_size { width: 200rpx; height: 200rpx; } .list_info { height: 200rpx; display: flex; flex-direction: column; margin-left: 20rpx; flex: 1; padding-right: 20rpx; } .list_info_text { overflow-wrap: break-word; word-wrap: break-word; /* 允许长单词或URL地址在容器内换行,防止内容溢出 */ width: 100%; },分析代码每个item右下角添加一个按钮
最新发布
08-30
<template> <view class="container"> <view class="search-container"> <view class="search-item name-picker"> <uni-data-picker v-model="queryParams.nickName" placeholder="姓名搜索" @change="handleNameChange" @clear="handleNameClear" clear-icon></uni-data-picker> </view> <view class="search-item date-picker"> <uni-datetime-picker v-model="createTime" type="daterange" @change="handleDateChange" /> </view> </view> <uni-list> <uni-list-item v-for="item in recordList" :key="item.clockinId"> <template v-slot:body> <view class="list-item-container"> <view class="left-content"> <text class="nick-name">{{item.nickName}}</text> <text class="time-info">{{getNoteContent(item)}}</text> </view> <view class="right-content" v-if="item.location && item.location !== '定位失败'"> <text class="location">{{item.location}}</text> </view> </view> </template> </uni-list-item> </uni-list> <view v-if="!loading && recordList.length === 0" class="empty"> 暂无打卡数据 </view> <view v-if="loading && recordList.length === 0" class="loading"> 加载中... </view> </view> </template> <script> import { clockInList } from '@/api/clockin/clockin.js'; export default { data() { return { recordList: [], loading: false, pageNum: 1, // 当前页码 pageSize: 10, // 每页显示条数 total: 0, // 总条数 createTime: [], queryParams: { startDate: '', // 筛选的开始日期 endDate: '', // 筛选的结束日期 nickName: '' // 筛选的姓名 } } }, onReady() { uni.setNavigationBarTitle({ title: '打卡记录' }); uni.hideLoading(); }, onShow() { this.pageNum = 1; this.recordList = []; this.fetchCheckinList().catch(error => { console.error('获取打卡列表失败:', error); uni.showToast({ title: '加载失败', icon: 'none' }); }); }, onPullDownRefresh() { this.initData(); this.fetchCheckinList() .then(() => { uni.stopPullDownRefresh(); // 停止刷新动画 }) .catch(error => { console.error('获取打卡列表失败:', error); uni.showToast({ title: '加载失败', icon: 'none' }); uni.stopPullDownRefresh(); }); }, onReachBottom() { if (this.loading || this.noData) return; if (this.recordList.length >= this.total && this.total > 0) { this.noData = true; return; } this.pageNum++; this.fetchCheckinList().catch(error => { console.error('获取打卡列表失败:', error); uni.showToast({ title: '加载失败', icon: 'none' }); }); }, methods: { initData() { this.pageNum = 1; this.recordList = []; this.noData = false; }, // 获取打卡列表 getstatus(item) { switch (item.type) { case 0: return "上班"; case 1: return "下班"; case 2: return "补卡上班"; default: return "补卡下班"; } }, getNoteContent(item) { return `${this.getstatus(item)} | ${item.createTime}`; }, gettime(item) { return item.createTime; }, fetchCheckinList() { this.loading = true; // 创建干净的请求参数(排除空值) const params = { pageNum: this.pageNum, pageSize: this.pageSize, nickName: this.queryParams.nickName || undefined, }; if (this.queryParams.startDate) params.startDate = this.queryParams.startDate; if (this.queryParams.endDate) params.endDate = this.queryParams.endDate; return clockInList(this.queryParams).then(response => { this.total = response.total || 0; const newData = response.rows || []; if (this.pageNum === 1) { this.recordList = newData; } else { this.recordList = [...this.recordList, ...newData]; } // 检查是否已加载全部数据 if (this.recordList.length >= this.total) { this.noData = true; } }).catch(error => { console.error('获取打卡列表失败:', error); uni.showToast({ title: '加载失败', icon: 'none' }); }).finally(() => { this.loading = false; }); }, handleDateChange() { // 正确设置时间范围参数 if (this.createTime && this.createTime.length === 2) { this.queryParams.beginTime = this.createTime[0]; this.queryParams.endTime = this.createTime[1]; } else { // 清空无效的时间范围 this.queryParams.beginTime = undefined; this.queryParams.endTime = undefined; } this.queryParams.pageNum = 1 this.fetchCheckinList() }, } } </script> <style> .container { padding: 0; } .search-container { padding: 15rpx; background-color: #fff; display: flex; flex-wrap: nowrap; /* 禁止换行 */ gap: 10rpx; overflow-x: auto; } /* 姓名搜索框 */ .search-item.name-picker { flex: 1.2; min-width: 200rpx; } .search-item.date-picker { flex: 2; min-width: 300rpx; } .picker { padding: 16rpx 20rpx; border: 1rpx solid #e5e5e5; border-radius: 8rpx; font-size: 14px; text-align: center; white-space: nowrap; } .watermark { color: #c0c0c0 !important; opacity: 0.8; } .list-item-container { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; padding: 20rpx 30rpx; } .left-content { flex-shrink: 0; display: flex; flex-direction: column; margin-right: 20rpx; white-space: nowrap; /* 确保左侧内容不换行 */ } .right-content { flex-grow: 1; text-align: right; word-break: break-all; /* 允许地址换行 */ } .nick-name { font-size: 16px; color: #333; margin-bottom: 5px; } .time-info { font-size: 14px; color: #666; } .location { font-size: 12px; color: #999; } .loading, .empty { text-align: center; padding: 20rpx; color: #999; font-size: 14px; } </style> Duplicate keys detected: '275'. This may cause an update error. found in ---> at pages/work/checkinRecord.vue
07-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值