Commit 04da8d47 authored by yiruiwen's avatar yiruiwen

tabs组件新增count和offset参数,用于角标显示

优化image组件图片加载失败时显示的默认图可能为loading状态默认图的问题
修复readmore组件textIndent参数引用错误的问题
完善文档对read-more组件内嵌parse组件时,可能产生的兼容性解决办法
parent e3c5744e
......@@ -7,7 +7,7 @@ text {
/* start--演示页面使用的统一样式--start */
.u-demo {
padding: 50rpx 40rpx;
padding: 25px 20px;
}
.u-demo-wrap {
......@@ -15,8 +15,8 @@ text {
border-color: #ddd;
border-style: dashed;
background-color: rgb(250, 250, 250);
padding: 40rpx 20rpx;
border-radius: 6px;
padding: 20px 10px;
border-radius: 3px;
}
.u-demo-area {
......@@ -25,19 +25,19 @@ text {
.u-no-demo-here {
color: $u-tips-color;
font-size: 26rpx;
font-size: 13px;
}
.u-demo-result-line {
border-width: 1px;
border-color: #ddd;
border-style: dashed;
padding: 10rpx 40rpx;
margin-top: 30rpx;
padding: 5px 20px;
margin-top: 30px;
border-radius: 5px;
background-color: rgb(240, 240, 240);
color: $u-content-color;
font-size: 32rpx;
font-size: 16px;
/* #ifndef APP-NVUE */
word-break: break-word;
display: inline-block;
......@@ -49,26 +49,26 @@ text {
.u-demo-title,
.u-config-title {
text-align: center;
font-size: 32rpx;
font-size: 16px;
font-weight: bold;
margin-bottom: 40rpx;
margin-bottom: 20px;
}
.u-config-item {
margin-top: 50rpx;
margin-top: 25px;
}
.u-config-title {
margin-top: 40rpx;
padding-bottom: 10rpx;
margin-top: 20px;
padding-bottom: 5px;
}
.u-item-title {
position: relative;
font-size: 28rpx;
font-size: 15px;
padding-left: 8px;
line-height: 1;
margin-bottom: 22rpx;
margin-bottom: 11px;
}
.u-item-title:after {
......
......@@ -47,14 +47,14 @@
<style lang="scss" scoped>
.nav-wrap {
padding: 30rpx;
padding: 15px;
position: relative;
}
.lang {
position: absolute;
top: 30rpx;
right: 30rpx;
top: 15px;
right: 15px;
}
.nav-title {
......@@ -66,7 +66,7 @@
}
.nav-info {
margin-left: 30rpx;
margin-left: 15px;
}
.nav-title__text {
......@@ -74,12 +74,12 @@
display: flex;
/* #endif */
color: $u-main-color;
font-size: 50rpx;
font-size: 25px;
font-weight: bold;
}
.logo {
width: 140rpx;
width: 70px;
/* #ifndef APP-NVUE */
height: auto;
/* #endif */
......@@ -87,12 +87,12 @@
.nav-slogan {
color: $u-tips-color;
font-size: 28rpx;
font-size: 14px;
}
.nav-desc {
margin-top: 20rpx;
font-size: 28rpx;
margin-top: 10px;
font-size: 14px;
color: $u-content-color;
}
</style>
......@@ -2,7 +2,7 @@
"name" : "uView",
"appid" : "__UNI__60F4B81",
"description" : "多平台快速开发的UI框架",
"versionName" : "1.7.3",
"versionName" : "1.7.4",
"versionCode" : "100",
"transformPx" : false,
"app-plus" : {
......
......@@ -178,6 +178,7 @@ page {
font-size: 30rpx;
margin-top: 5px;
color: $u-main-color;
word-break: break-all;
}
.demo-tag {
......
......@@ -4,7 +4,7 @@
<view class="u-demo-title">演示效果</view>
<view class="u-demo-area">
<u-number-box v-model="value" :bg-color="bgColor" :color="color" :min="0"
:step="step" :disabled="disabled" @change="change"></u-number-box>
:step="step" :disabled="disabled" @change="change" @focus="focus"></u-number-box>
</view>
</view>
<view class="u-config-wrap">
......@@ -64,6 +64,9 @@ export default {
},
change(e) {
//console.log(e.value);
},
focus() {
console.log('focus');
}
}
};
......
......@@ -11,7 +11,7 @@
color: value == item.value ? activeColor : inactiveColor
}">
<u-icon v-if="value == item.value" name="checkbox-mark" :color="activeColor" size="32"></u-icon>
</u-cell-item>
</u-cell-item>
</u-cell-group>
</view>
</scroll-view>
......@@ -62,7 +62,7 @@
height: {
type: [Number, String],
default: 'auto'
}
},
},
data() {
return {
......
......@@ -14,7 +14,7 @@
<view class="u-dropdown__menu__item__arrow" :class="{
'u-dropdown__menu__item__arrow--rotate': index === current
}">
<u-icon :custom-style="{display: 'flex'}" name="arrow-down" size="26" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"></u-icon>
<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="$u.addUnit(menuIconSize)" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"></u-icon>
</view>
</view>
</view>
......@@ -98,6 +98,16 @@
borderRadius: {
type: [Number, String],
default: 0
},
// 菜单右侧的icon图标
menuIcon: {
type: String,
default: 'arrow-down'
},
// 菜单右侧图标的大小
menuIconSize: {
type: [Number, String],
default: 26
}
},
data() {
......
......@@ -9,7 +9,7 @@
<u-icon name="minus" :size="size"></u-icon>
</view>
<input :disabled="disabledInput || disabled" :cursor-spacing="getCursorSpacing" :class="{ 'u-input-disabled': disabled }"
v-model="inputVal" class="u-number-input" @blur="onBlur"
v-model="inputVal" class="u-number-input" @blur="onBlur" @focus="onFocus"
type="number" :style="{
color: color,
fontSize: size + 'rpx',
......@@ -288,6 +288,10 @@
})
this.handleChange(val, 'blur');
},
// 输入框获得焦点事件
onFocus() {
this.$emit('focus');
},
handleChange(value, type) {
if (this.disabled) return;
// 清除定时器,避免造成混乱
......
......@@ -57,7 +57,10 @@ parser.prototype.Comment = function() {
}
parser.prototype.Ignore = function(c) {
if (c == '{') this.floor++;
else if (c == '}' && !--this.floor) this.state = this.Space;
else if (c == '}' && !--this.floor) {
this.list = [];
this.state = this.Space;
}
}
parser.prototype.Name = function(c) {
if (cfg.blankChar[c]) {
......
/**
* html 解析器
* @tutorial https://github.com/jin-yufeng/Parser
* @version 20200828
* @version 20201014
* @author JinYufeng
* @listens MIT
*/
......@@ -25,10 +25,7 @@ function MpHtmlParser(data, options = {}) {
// 工具函数
this.bubble = () => {
for (var i = this.STACK.length, item; item = this.STACK[--i];) {
if (cfg.richOnlyTags[item.name]) {
if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1;
return false;
}
if (cfg.richOnlyTags[item.name]) return false;
item.c = 1;
}
return true;
......@@ -210,12 +207,15 @@ MpHtmlParser.prototype.setNode = function() {
if (attrs.colspan || attrs.rowspan)
for (var k = this.STACK.length, item; item = this.STACK[--k];)
if (item.name == 'table') {
item.c = void 0;
item.flag = 1;
break;
}
}
if (attrs.align) {
styleObj['text-align'] = attrs.align;
if (node.name == 'table') {
if (attrs.align == 'center') styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto';
else styleObj['float'] = attrs.align;
} else styleObj['text-align'] = attrs.align;
attrs.align = void 0;
}
// 压缩 style
......@@ -308,10 +308,12 @@ MpHtmlParser.prototype.remove = function(node) {
// 处理 svg
var handleSvg = () => {
var src = this.data.substring(j, this.i + 1);
if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src;
var i = j;
while (this.data[j] != '<') j--;
src = this.data.substring(j, i).replace("viewbox", "viewBox") + src;
node.attrs.xmlns = 'http://www.w3.org/2000/svg';
for (var key in node.attrs) {
if (key == 'viewbox') src = ` viewBox="${node.attrs.viewbox}"` + src;
else if (key != 'style') src = ` ${key}="${node.attrs[key]}"` + src;
}
src = '<svg' + src;
var parent = this.parent();
if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline'))
parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
......@@ -319,7 +321,7 @@ MpHtmlParser.prototype.remove = function(node) {
name: 'img',
attrs: {
src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
style: (/vertical[^;]+/.exec(node.attrs.style) || []).shift(),
style: node.attrs.style,
ignore: 'T'
}
})
......@@ -400,35 +402,78 @@ MpHtmlParser.prototype.popNode = function(node) {
}
}
}
// 处理表格的边框
// 处理表格
if (node.name == 'table') {
var padding = attrs.cellpadding,
spacing = attrs.cellspacing,
border = attrs.border;
var padding = parseFloat(attrs.cellpadding),
spacing = parseFloat(attrs.cellspacing),
border = parseFloat(attrs.border);
if (node.c) {
this.bubble();
attrs.style = (attrs.style || '') + ';display:table';
if (!padding) padding = 2;
if (!spacing) spacing = 2;
if (isNaN(padding)) padding = 2;
if (isNaN(spacing)) spacing = 2;
}
if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`;
if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`;
if (border || padding || node.c)
if (node.flag && node.c) {
// 有 colspan 或 rowspan 且含有链接的表格转为 grid 布局实现
attrs.style = `${attrs.style || ''};${spacing ? `;grid-gap:${spacing}px` : ';border-left:0;border-top:0'}`;
var row = 1,
col = 1,
colNum,
trs = [],
children = [],
map = {};
(function f(ns) {
for (var i = 0, n; n = ns[i]; i++) {
if (n.type == 'text') continue;
var style = n.attrs.style || '';
if (node.c && n.name[0] == 't') {
n.c = 1;
style += ';display:table-' + (n.name == 'th' || n.name == 'td' ? 'cell' : (n.name == 'tr' ? 'row' : 'row-group'));
for (var i = 0; i < ns.length; i++) {
if (ns[i].name == 'tr') trs.push(ns[i]);
else f(ns[i].children || []);
}
})(node.children)
for (let i = 0; i < trs.length; i++) {
for (let j = 0, td; td = trs[i].children[j]; j++) {
if (td.name == 'td' || td.name == 'th') {
while (map[row + '.' + col]) col++;
var cell = {
name: 'div',
c: 1,
attrs: {
style: (td.attrs.style || '') + (border ? `;border:${border}px solid gray` + (spacing ? '' :
';border-right:0;border-bottom:0') : '') + (padding ? `;padding:${padding}px` : '')
},
children: td.children
}
if (td.attrs.colspan) {
cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + parseInt(td.attrs.colspan));
if (!td.attrs.rowspan) cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + 1);
col += parseInt(td.attrs.colspan) - 1;
}
if (td.attrs.rowspan) {
cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + parseInt(td.attrs.rowspan));
if (!td.attrs.colspan) cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + 1);
for (var k = 1; k < td.attrs.rowspan; k++) map[(row + k) + '.' + col] = 1;
}
children.push(cell);
col++;
}
if (n.name == 'th' || n.name == 'td') {
if (border) style = `border:${border}px solid gray;${style}`;
if (padding) style = `padding:${padding}px;${style}`;
} else f(n.children || []);
if (style) n.attrs.style = style;
}
})(childs)
if (!colNum) {
colNum = col - 1;
attrs.style += `;grid-template-columns:repeat(${colNum},auto)`
}
col = 1;
row++;
}
node.children = children;
} else {
attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`;
if (border || padding)
(function f(ns) {
for (var i = 0, n; n = ns[i]; i++) {
if (n.name == 'th' || n.name == 'td') {
if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style || ''}`;
if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style || ''}`;
} else f(n.children || []);
}
})(childs)
}
if (this.options.autoscroll) {
var table = Object.assign({}, node);
node.name = 'div';
......
......@@ -33,7 +33,7 @@ var cfg = {
// 将被移除的标签
ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
// 只能被 rich-text 显示的标签
richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'),
richOnlyTags: makeMap('a,colgroup,fieldset,legend'),
// 自闭合的标签
selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
// 信任的标签
......
......@@ -14,16 +14,16 @@
<text v-else-if="n.name=='br'">\n</text>
<!--#endif-->
<!--视频-->
<view v-else-if="((n.lazyLoad&&!n.attrs.autoplay)||(n.name=='video'&&!loadVideo))&&ctrl[i]==undefined" :id="n.attrs.id" :class="'_video '+(n.attrs.class||'')"
:style="n.attrs.style" :data-i="i" @tap="_loadVideo" />
<view v-else-if="((n.lazyLoad&&!n.attrs.autoplay)||(n.name=='video'&&!loadVideo))&&ctrl[i]==undefined" :id="n.attrs.id"
:class="'_video '+(n.attrs.class||'')" :style="n.attrs.style" :data-i="i" @tap="_loadVideo" />
<video v-else-if="n.name=='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||ctrl[i]==0"
:controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[ctrl[i]||0]"
:unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" :data-i="i" data-source="video" @error="error" @play="play" />
<!--音频-->
<audio v-else-if="n.name=='audio'" :ref="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author"
:autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster"
:src="n.attrs.source[ctrl[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio"
@error.native="error" @play.native="play" />
:src="n.attrs.source[ctrl[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio" @error.native="error"
@play.native="play" />
<!--链接-->
<view v-else-if="n.name=='a'" :id="n.attrs.id" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
:data-attrs="n.attrs" @tap="linkpress">
......@@ -42,6 +42,10 @@
<trees class="_li" c="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
</view>
<!--表格-->
<view v-else-if="n.name=='table'&&n.c&&n.flag" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:grid'">
<trees v-for="(cell,n) in n.children" v-bind:key="n" :class="cell.attrs.class" :c="cell.attrs.class" :style="cell.attrs.style"
:s="cell.attrs.style" :nodes="cell.children" />
</view>
<view v-else-if="n.name=='table'&&n.c" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:table'">
<view v-for="(tbody, o) in n.children" v-bind:key="o" :class="tbody.attrs.class" :style="(tbody.attrs.style||'')+(tbody.name[0]=='t'?';display:table-'+(tbody.name=='tr'?'row':'row-group'):'')">
<view v-for="(tr, p) in tbody.children" v-bind:key="p" :class="tr.attrs.class" :style="(tr.attrs.style||'')+(tr.name[0]=='t'?';display:table-'+(tr.name=='tr'?'row':'cell'):'')">
......@@ -337,7 +341,7 @@
._li {
display: block;
}
/* #endif */
._code {
......
......@@ -66,7 +66,7 @@
* @event {Function} imgtap 图片点击事件
* @event {Function} linkpress 链接点击事件
* @author JinYufeng
* @version 20200828
* @version 20201014
* @listens MIT
*/
export default {
......@@ -529,7 +529,7 @@
style += '</style>';
html = style + html;
}
// 处理rpx
// 处理 rpx
if (html.includes('rpx'))
html = html.replace(/[0-9.]+\s*rpx/g, $ => (parseFloat($) * windowWidth / 750) + 'px');
return html;
......
......@@ -114,7 +114,7 @@
};
},
mounted() {
this.$nextTick(function() {
this.$nextTick(() => {
this.init();
})
},
......
// 此版本发布于2020-09-22
let version = '1.7.3';
// 此版本发布于2020-10-13
let version = '1.7.4';
export default {
v: version,
......
{
"name": "uview-ui",
"version": "1.7.3",
"version": "1.7.6",
"description": "uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
"main": "index.js",
"keywords": ["uview", "uView", "uni-app", "uni-app ui", "uniapp", "uviewui", "uview ui", "uviewUI", "uViewui", "uViewUI", "uView UI", "uni ui", "uni UI", "uniapp ui", "ui", "UI框架", "uniapp ui框架", "uniapp UI"],
"keywords": [
"uview",
"uView",
"uni-app",
"uni-app ui",
"uniapp",
"uviewui",
"uview ui",
"uviewUI",
"uViewui",
"uViewUI",
"uView UI",
"uni ui",
"uni UI",
"uniapp ui",
"ui",
"UI框架",
"uniapp ui框架",
"uniapp UI"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment