!135 fix 了一些问题

Merge pull request !135 from puhui999/dev
pull/136/head^2
芋道源码 2025-01-23 04:30:59 +00:00 committed by Gitee
commit 730025128a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 217 additions and 99 deletions

View File

@ -19,7 +19,7 @@
// urlSchemes
const args = plus.runtime.arguments;
if (args) {
}
}
//
uni.getClipboardData({

View File

@ -5,7 +5,7 @@
navbar="inner"
>
<!-- 覆盖头部导航栏背景颜色 -->
<div class="page-bg" :style="{ height: sys_navBar + 'px' }"></div>
<view class="page-bg" :style="{ height: sys_navBar + 'px' }"></view>
<!-- 聊天区域 -->
<MessageList ref="messageListRef">
<template #bottom>

View File

@ -166,7 +166,7 @@
></view
>
<view>
<text class="num">{{ item.brokeragePrice || 0 }}</text
<text class="num">{{ fen2yuan(item.brokeragePrice) || 0 }}</text
>
</view>
</view>
@ -259,6 +259,7 @@
import _ from 'lodash-es';
import { onPageScroll } from '@dcloudio/uni-app';
import BrokerageApi from '@/sheep/api/trade/brokerage';
import { fen2yuan } from '../../sheep/hooks/useGoods';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
// const agentInfo = computed(() => sheep.$store('user').agentInfo);

View File

@ -15,6 +15,9 @@
:key="item.text"
:text="item.text"
:name="item.url"
:badge="item.badge"
:dot="item.dot"
:badgeStyle="tabbar.badgeStyle"
:isCenter="getTabbarCenter(index)"
:centerImage="sheep.$url.cdn(item.iconUrl)"
@tap="sheep.$router.go(item.url)"
@ -33,6 +36,7 @@
<script setup>
import { computed, unref } from 'vue';
import sheep from '@/sheep';
import SuTabbar from '@/sheep/ui/su-tabbar/su-tabbar.vue';
const tabbar = computed(() => {
return sheep.$store('app').template.basic?.tabbar;

View File

@ -130,38 +130,35 @@ const decryptSpm = (spm) => {
// 普通商品
shareParams.page = SharePageEnum.GOODS.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
case SharePageEnum.GROUPON.value:
// 拼团商品
shareParams.page = SharePageEnum.GROUPON.page;
query = shareParamsArray[2].split(',');
shareParams.query = {
id: query[0],
activity_id: query[1],
id: shareParamsArray[2], // 设置活动编号
};
break;
case SharePageEnum.SECKILL.value:
// 秒杀商品
shareParams.page = SharePageEnum.SECKILL.page;
query = shareParamsArray[2].split(',');
shareParams.query = {
id: query[0],
id: shareParamsArray[2], // 设置活动编号
};
break;
case SharePageEnum.GROUPON_DETAIL.value:
// 参与拼团
shareParams.page = SharePageEnum.GROUPON_DETAIL.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
case SharePageEnum.POINT.value:
// 积分商品
shareParams.page = SharePageEnum.POINT.page;
shareParams.query = {
id: shareParamsArray[2],
id: shareParamsArray[2], // 设置活动编号
};
break;
}

View File

@ -1,39 +1,40 @@
@import './mixins';
// 60%
$yellow: #ffc300; //ss-
$orange: #ff6000; //ss-
$red: #ff3000; //ss-
$pink: #e03997;
$mauve: #b745cb;
$purple: #652abf; //rgba(101, 42, 191, 1); // ss-
$blue: #0081ff;
$cyan: #37c0fe;
$green: #2aae67; //ss-绿
$olive: #8dc63f;
$grey: #8799a3;
$brown: #a5673f;
$black: #484848; //ss-
$golden: #e9b461; //ss-
$red: #d10019; //
$orange: #f37b1d; //
$gold: #fbbd08; //
$green: #8dc63f; // 绿
$cyan: #1cbbb4; //
$blue: #0081ff; //
$purple: #6739b6; //
$brightRed: #e54d42; //
$forestGreen: #39b54a; // 绿
$mauve: #9c26b0; // 槿
$pink: #e03997; //
$brown: #a5673f; //
$grey: #8799a3; //
$gray: #aaaaaa; //
$black: #333333; //
$colors: ();
$colors: map-merge(
(
'yellow': $yellow,
'orange': $orange,
'red': $red,
'pink': $pink,
'mauve': $mauve,
'purple': $purple,
'violet': $purple,
'blue': $blue,
'cyan': $cyan,
'green': $green,
'olive': $olive,
'grey': $grey,
'brown': $brown,
'black': $black,
'golden': $golden,
'red':$red,
'orange':$orange,
'gold':$gold,
'green':$green,
'cyan':$cyan,
'blue':$blue,
'purple':$purple,
'brightRed':$brightRed,
'forestGreen':$forestGreen,
'mauve':$mauve,
'pink':$pink,
'brown':$brown,
'grey':$grey,
'gray':$gray,
'black':$black,
),
$colors
);

View File

@ -128,6 +128,14 @@ const adaptTemplate = async (appTemplate, templateId) => {
const tabBar = diyTemplate?.property?.tabBar;
if (tabBar) {
appTemplate.basic.tabbar = tabBar;
// TODO 商城装修没有对 tabBar 进行角标配置,测试角标需打开以下注释
// appTemplate.basic.tabbar.items.forEach((tabBar) => {
// tabBar.dot = false
// tabBar.badge = 100
// })
// appTemplate.basic.tabbar.badgeStyle = {
// backgroundColor: '#882222',
// }
if (tabBar?.theme) {
appTemplate.basic.theme = tabBar?.theme;
}

View File

@ -6,24 +6,24 @@
</view>
<template v-else>
<view class="u-tabbar-item__icon">
<image
v-if="icon"
:name="icon"
:color="isActive ? parentData.activeColor : parentData.inactiveColor"
:size="20"
></image>
<block v-else>
<slot v-if="isActive" name="active-icon" />
<slot v-else name="inactive-icon" />
</block>
<!-- <u-badge
absolute
:offset="[0, dot ? '34rpx' : badge > 9 ? '14rpx' : '20rpx']"
:customStyle="badgeStyle"
:isDot="dot"
:value="badge || (dot ? 1 : null)"
:show="dot || badge > 0"
></u-badge> -->
<uni-badge
absolute="rightTop"
size="small"
:text="badge || (dot ? 1 : null)"
:customStyle="badgeStyle"
:isDot="dot"
>
<image
v-if="icon"
:name="icon"
:color="isActive ? parentData.activeColor : parentData.inactiveColor"
:size="20"
></image>
<block v-else>
<slot v-if="isActive" name="active-icon" />
<slot v-else name="inactive-icon" />
</block>
</uni-badge>
</view>
<slot name="text">
@ -44,16 +44,17 @@
/**
* TabbarItem 底部导航栏子组件
* @description 此组件提供了自定义tabbar的能力
* @property {String | Number} name item标签的名称作为与u-tabbar的value参数匹配的标识符
* @property {String} icon uView内置图标或者绝对路径的图片
* @property {String | Number} badge 右上角的角标提示信息
* @property {Boolean} dot 是否显示圆点将会覆盖badge参数默认 false
* @property {String} text 描述文本
* @property {Object | String} badgeStyle 控制徽标的位置对象或者字符串形式可以设置top和right属性默认 'top: 6px;right:2px;'
* @property {Object} customStyle 定义需要用到的外部样式
* @property {String | Number} name item标签的名称作为与u-tabbar的value参数匹配的标识符
* @property {String} icon uView内置图标或者绝对路径的图片
* @property {String | Number} badge 右上角的角标提示信息
* @property {Boolean} dot 是否显示圆点将会覆盖badge参数默认 false
* @property {String} text 描述文本
* @property {Object | String} badgeStyle 控制徽标的位置对象或者字符串形式可以设置top和right属性默认 'top: 6px;right:2px;'
* @property {Object} customStyle 定义需要用到的外部样式
*
*/
import { deepMerge, addStyle, sleep, $parent } from '@/sheep/helper';
import { $parent, addStyle } from '@/sheep/helper';
export default {
name: 'su-tabbar-item',
props: {
@ -102,8 +103,8 @@
},
// topright
badgeStyle: {
type: [Object, String],
default: '',
type: Object,
default: ()=>{},
},
isCenter: {
type: Boolean,
@ -202,6 +203,7 @@
height: 25px;
}
}
.u-tabbar-item {
display: flex;
flex-direction: column;
@ -230,5 +232,6 @@
:host {
flex: 1;
}
/* #endif */
</style>

View File

@ -186,6 +186,9 @@
可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复)
提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复
欢迎加入 `QQ` 交流群:`699734691`
欢迎加入 `QQ` 交流群:
群1已满`699734691`
群2已满`778239129`
群3`960265313`
查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多

View File

@ -1,3 +1,32 @@
## v2.5.02024-04-22
1. `U` `play` 事件增加返回 `src` 等信息 [详细](https://github.com/jin-yufeng/mp-html/issues/526)
2. `U` `preview-img` 属性支持设置为 `all` 开启 `base64` 图片预览 [详细](https://github.com/jin-yufeng/mp-html/issues/536)
3. `U` `editable` 插件增加简易模式(点击文字直接编辑)
4. `U` `latex` 插件支持块级公式 [详细](https://github.com/jin-yufeng/mp-html/issues/582)
5. `F` 修复了表格部分情况下背景丢失的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/587)
6. `F` 修复了部分 `svg` 无法显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/591)
7. `F` 修复了 `h5``app` 端部分情况下样式无法识别的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/518)
8. `F` 修复了 `latex` 插件部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/580)
9. `F` 修复了 `editable` 插件表格无法删除的问题
10. `F` 修复了 `editable` 插件 `vue3` `h5` 端点击图片报错的问题
11. `F` 修复了 `editable` 插件点击表格没有菜单栏的问题
## v2.4.32024-01-21
1. `A` 增加 [card](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#card) 插件 [详细](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami)
2. `F` 修复了 `svg` 中包含 `foreignobject` 可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/523)
3. `F` 修复了合并单元格的表格部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/561)
4. `F` 修复了 `img` 标签设置 `object-fit` 无效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/567)
5. `F` 修复了 `latex` 插件公式会换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/540)
6. `F` 修复了 `editable``audio` 插件共用时点击 `audio` 无法编辑的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami)
7. `F` 修复了微信小程序部分情况下图片会报错 `replace of undefined` 的问题
8. `F` 修复了快手小程序图片不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/571)
## v2.4.22023-05-14
1. `A` `editable` 插件支持修改文字颜色 [详细](https://github.com/jin-yufeng/mp-html/issues/254)
2. `F` 修复了 `svg` 中有 `style` 不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/505)
3. `F` 修复了使用旧版编译器可能报错 `Bad attr nodes` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/472)
4. `F` 修复了 `app` 端可能出现无法读取 `lazyLoad` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/513)
5. `F` 修复了 `editable` 插件在点击换图时未拼接 `domain` 的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/497) by [@TwoKe945](https://github.com/TwoKe945)
6. `F` 修复了 `latex` 插件部分情况下不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/515)
7. `F` 修复了 `editable` 插件点击音视频时其他标签框不消失的问题
## v2.4.12022-12-25
1. `F` 修复了没有图片时 `ready` 事件可能不触发的问题
2. `F` 修复了加载过程中可能出现 `Root label not found` 错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/470)

View File

@ -12,7 +12,7 @@
<script>
/**
* mp-html v2.4.1
* mp-html v2.5.0
* @description 富文本组件
* @tutorial https://github.com/jin-yufeng/mp-html
* @property {String} container-style 容器的样式

View File

@ -10,13 +10,16 @@
<!-- #endif -->
<!-- #ifndef H5 || (APP-PLUS && VUE2) -->
<!-- 表格中的图片使用 rich-text 防止大小不正确 -->
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="'<img class=\'_img\' style=\''+n.attrs.style+'\' src=\''+n.attrs.src+'\'>'" :data-i="i" @tap.stop="imgTap" />
<rich-text v-if="n.name==='img'&&n.t" :style="'display:'+n.t" :nodes="[{attrs:{style:n.attrs.style||'',src:n.attrs.src},name:'img'}]" :data-i="i" @tap.stop="imgTap" />
<!-- #endif -->
<!-- #ifndef H5 || APP-PLUS -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #ifndef H5 || APP-PLUS || MP-KUAISHOU -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;height:1px;'+n.attrs.style" :src="n.attrs.src" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))" :lazy-load="opts[0]" :webp="n.webp" :show-menu-by-longpress="opts[3]&&!n.attrs.ignore" :image-menu-prevent="!opts[3]||n.attrs.ignore" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #endif -->
<!-- #ifdef MP-KUAISHOU -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+n.attrs.style" :src="n.attrs.src" :lazy-load="opts[0]" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap"></image>
<!-- #endif -->
<!-- #ifdef APP-PLUS && VUE3 -->
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':'')" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<image v-else-if="n.name==='img'" :id="n.attrs.id" :class="'_img '+n.attrs.class" :style="(ctrl[i]===-1?'display:none;':'')+'width:'+(ctrl[i]||1)+'px;'+n.attrs.style" :src="n.attrs.src||(ctrl.load?n.attrs['data-src']:'')" :mode="!n.h?'widthFix':(!n.w?'heightFix':(n.m||''))" :data-i="i" @load="imgLoad" @error="mediaError" @tap.stop="imgTap" @longpress="imgLongTap" />
<!-- #endif -->
<!-- 文本 -->
<!-- #ifdef MP-WEIXIN -->
@ -67,7 +70,7 @@
<rich-text v-else-if="!n.c&&!handler.isInline(n.name, n.attrs.style)" :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" />
<!-- #endif -->
<!-- #ifndef H5 || ((MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE2) -->
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="n.f+';display:inline'" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
<rich-text v-else-if="!n.c" :id="n.attrs.id" :style="'display:inline;'+n.f" :preview="false" :selectable="opts[4]" :user-select="opts[4]" :nodes="[n]" />
<!-- #endif -->
<!-- 继续递归 -->
<view v-else-if="n.c===2" :id="n.attrs.id" :class="'_block _'+n.name+' '+n.attrs.class" :style="n.f+';'+n.attrs.style">
@ -184,7 +187,15 @@ export default {
* @param {Event} e
*/
play (e) {
this.root.$emit('play')
const i = e.currentTarget.dataset.i
const node = this.childs[i]
this.root.$emit('play', {
source: node.name,
attrs: {
...node.attrs,
src: node.src[this.ctrl[i] || 0]
}
})
// #ifndef APP-PLUS
if (this.root.pauseVideo) {
let flag = false
@ -299,7 +310,7 @@ export default {
* @description 检查是否所有图片加载完毕
*/
checkReady () {
if (!this.root.lazyLoad) {
if (this.root && !this.root.lazyLoad) {
this.root._unloadimgs -= 1
if (!this.root._unloadimgs) {
setTimeout(() => {

View File

@ -71,7 +71,8 @@ const config = {
viewbox: 'viewBox',
attributename: 'attributeName',
repeatcount: 'repeatCount',
repeatdur: 'repeatDur'
repeatdur: 'repeatDur',
foreignobject: 'foreignObject'
}
}
const tagSelector={}
@ -321,6 +322,7 @@ Parser.prototype.onTagName = function (name) {
this.tagName = this.xml ? name : name.toLowerCase()
if (this.tagName === 'svg') {
this.xml = (this.xml || 0) + 1 // svg 标签内大小写敏感
config.ignoreTags.style = undefined // svg 标签内 style 可用
}
}
@ -331,6 +333,12 @@ Parser.prototype.onTagName = function (name) {
*/
Parser.prototype.onAttrName = function (name) {
name = this.xml ? name : name.toLowerCase()
// #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE
if (name.includes('?') || name.includes(';')) {
this.attrName = undefined
return
}
// #endif
if (name.substr(0, 5) === 'data-') {
if (name === 'data-src' && !this.attrs.src) {
// data-src 自动转为 src
@ -457,7 +465,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
node.webp = 'T'
}
// data url 图片如果没有设置 original-src 默认为不可预览的小图片
if (attrs.src.includes('data:') && !attrs['original-src']) {
if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) {
attrs.ignore = 'T'
}
if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {
@ -551,6 +559,13 @@ Parser.prototype.onOpenTag = function (selfClose) {
if (!isNaN(parseInt(styleObj.height)) && (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))) {
node.h = 'T'
}
if (node.w && node.h && styleObj['object-fit']) {
if (styleObj['object-fit'] === 'contain') {
node.m = 'aspectFit'
} else if (styleObj['object-fit'] === 'cover') {
node.m = 'aspectFill'
}
}
} else if (node.name === 'svg') {
siblings.push(node)
this.stack.push(node)
@ -677,11 +692,19 @@ Parser.prototype.popNode = function () {
return
}
const name = config.svgDict[node.name] || node.name
if (name === 'foreignObject') {
for (const child of (node.children || [])) {
if (child.attrs && !child.attrs.xmlns) {
child.attrs.xmlns = 'http://www.w3.org/1999/xhtml'
break
}
}
}
src += '<' + name
for (const item in node.attrs) {
const val = node.attrs[item]
if (val) {
src += ` ${config.svgDict[item] || item}="${val}"`
src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"`
}
}
if (!node.children) {
@ -703,6 +726,7 @@ Parser.prototype.popNode = function () {
node.children = undefined
// #endif
this.xml = false
config.ignoreTags.style = true
return
}
@ -839,6 +863,10 @@ Parser.prototype.popNode = function () {
if (node.flag && node.c) {
// 有 colspan 或 rowspan 且含有链接的表格通过 grid 布局实现
styleObj.display = 'grid'
if (styleObj['border-collapse'] === 'collapse') {
styleObj['border-collapse'] = undefined
spacing = 0
}
if (spacing) {
styleObj['grid-gap'] = spacing + 'px'
styleObj.padding = spacing + 'px'
@ -856,6 +884,23 @@ Parser.prototype.popNode = function () {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].name === 'tr') {
trList.push(nodes[i])
} else if (nodes[i].name === 'colgroup') {
let colI = 1
for (const col of (nodes[i].children || [])) {
if (col.name === 'col') {
const style = col.attrs.style || ''
const start = style.indexOf('width') ? style.indexOf(';width') : 0
// 提取出宽度
if (start !== -1) {
let end = style.indexOf(';', start + 6)
if (end === -1) {
end = style.length
}
width[colI] = style.substring(start ? start + 7 : 6, end)
}
colI += 1
}
}
} else {
traversal(nodes[i].children || [])
}
@ -982,11 +1027,26 @@ Parser.prototype.popNode = function () {
node.children = [table]
attrs = table.attrs
}
} else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) {
node.flag = undefined;
(function traversal (nodes) {
for (let i = 0; i < nodes.length; i++) {
if (nodes[i].name === 'td') {
// 颜色样式设置给单元格避免丢失
for (const style of ['color', 'background', 'background-color']) {
if (styleObj[style]) {
nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '')
}
}
} else {
traversal(nodes[i].children || [])
}
}
})(children)
} else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) {
for (let i = this.stack.length; i--;) {
if (this.stack[i].name === 'table') {
if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') {
this.stack[i].flag = 1 // 指示含有合并单元格
break
}
}
} else if (node.name === 'ruby') {

View File

@ -1,7 +1,7 @@
{
"id": "mp-html",
"displayName": "mp-html 富文本组件【全端支持支持编辑、latex等扩展】",
"version": "v2.4.1",
"version": "v2.5.0",
"description": "一个强大的富文本组件,高效轻量,功能丰富",
"keywords": [
"富文本",

View File

@ -1,3 +1,7 @@
## 1.2.22023-01-28
- 修复 运行/打包 控制台警告问题
## 1.2.12022-09-05
- 修复 当 text 超过 max-num 时badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)

View File

@ -1,7 +1,7 @@
<template>
<view class="uni-badge--x">
<slot />
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]"
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]"
class="uni-badge" @click="onClick()">{{displayValue}}</text>
</view>
</template>
@ -21,7 +21,7 @@
* @value error 红色
* @property {String} inverted = [true|false] 是否无需背景颜色
* @property {Number} maxNum 展示封顶的数字值超过 99 显示 99+
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
* @value rightTop 右上
* @value rightBottom 右下
* @value leftTop 左上
@ -130,16 +130,13 @@
const match = whiteList[this.absolute]
return match ? match : whiteList['rightTop']
},
badgeWidth() {
return {
width: `${this.width}px`
}
},
dotStyle() {
if (!this.isDot) return {}
return {
width: '10px',
minWidth: '0',
height: '10px',
padding: '0',
borderRadius: '10px'
}
},
@ -160,7 +157,7 @@
};
</script>
<style lang="scss" scoped>
<style lang="scss" >
$uni-primary: #2979ff !default;
$uni-success: #4cd964 !default;
$uni-warning: #f0ad4e !default;
@ -195,10 +192,13 @@
display: flex;
overflow: hidden;
box-sizing: border-box;
font-feature-settings: "tnum";
min-width: 20px;
/* #endif */
justify-content: center;
flex-direction: row;
height: 20px;
padding: 0 4px;
line-height: 18px;
color: #fff;
border-radius: 100px;

View File

@ -1,7 +1,7 @@
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
"version": "1.2.0",
"version": "1.2.2",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
@ -18,11 +18,7 @@
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
@ -39,10 +35,11 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [],
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {