Skip to content

Commit 582557e

Browse files
committed
1. 新增man,woman,level三个图标,修复某些图标缺失的问题
2. 修复section组件showLine参数无法隐藏左边竖条的问题
1 parent bb453ec commit 582557e

File tree

17 files changed

+353
-354
lines changed

17 files changed

+353
-354
lines changed

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name" : "uView",
33
"appid" : "__UNI__60F4B81",
44
"description" : "多平台快速开发的UI框架",
5-
"versionName" : "1.5.6",
5+
"versionName" : "1.5.7",
66
"versionCode" : "100",
77
"transformPx" : false,
88
"app-plus" : {
@@ -107,7 +107,7 @@
107107
},
108108
"mp-alipay" : {
109109
"usingComponents" : true,
110-
"component2": true
110+
"component2" : true
111111
},
112112
"mp-baidu" : {
113113
"usingComponents" : true,

pages/componentsA/icon/index.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
data() {
1515
return {
1616
iconList: [
17+
{
18+
name: 'level'
19+
},
20+
{
21+
name: 'woman'
22+
},
23+
{
24+
name: 'man'
25+
},
1726
{
1827
name: 'arrow-left-double'
1928
},

pages/componentsC/section/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<view class="u-demo-wrap">
44
<view class="u-demo-title">演示效果</view>
55
<view class="u-demo-area">
6-
<u-section :title="title" :right="right" :bold="bold" :color="color"></u-section>
6+
<u-section :title="title" :right="right" :bold="bold" :color="color" :show-line="false"></u-section>
77
</view>
88
</view>
99
<view class="u-config-wrap">

uview-ui/components/u-icon/u-icon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default {
168168
fontSize: this.size == 'inherit' ? 'inherit' : this.$u.addUnit(this.size),
169169
fontWeight: this.bold ? 'bold' : 'normal',
170170
// 安卓和iOS各需要设置一个到顶部的距离,才能更好的垂直居中
171-
top: this.top === '' ? (this.$u.os == 'ios' ? '2rpx' : '4rpx') : 0
171+
top: this.top === '' ? (this.$u.os == 'ios' ? '2rpx' : '4rpx') : this.$u.addUnit(this.top)
172172
};
173173
// 非主题色值时,才当作颜色值
174174
if (this.color && !this.$u.config.type.includes(this.color)) style.color = this.color;

uview-ui/components/u-input/u-input.vue

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,32 @@
7171
<script>
7272
import Emitter from '../../libs/util/emitter.js';
7373
74-
/**
75-
* input 输入框
76-
* @description 此组件为一个输入框,默认没有边框和样式,是专门为配合表单组件u-form而设计的,利用它可以快速实现表单验证,输入内容,下拉选择等功能。
77-
* @tutorial http://uviewui.com/components/input.html
78-
* @property {String} type 模式选择,见官网说明
79-
* @property {Boolean} clearable 是否显示右侧的清除图标(默认true)
80-
* @property {} v-model 用于双向绑定输入框的值
81-
* @property {String} input-align 输入框文字的对齐方式(默认left)
82-
* @property {String} placeholder placeholder显示值(默认 '请输入内容')
83-
* @property {Boolean} disabled 是否禁用输入框(默认false)
84-
* @property {String Number} maxlength 输入框的最大可输入长度(默认140)
85-
* @property {String Number} selection-start 光标起始位置,自动聚焦时有效,需与selection-end搭配使用(默认-1)
86-
* @property {String Number} maxlength 光标结束位置,自动聚焦时有效,需与selection-start搭配使用(默认-1)
87-
* @property {String Number} cursor-spacing 指定光标与键盘的距离,单位px(默认0)
88-
* @property {String} placeholderStyle placeholder的样式,字符串形式,如"color: red;"(默认 "color: #c0c4cc;")
89-
* @property {String} confirm-type 设置键盘右下角按钮的文字,仅在type为text时生效(默认done)
90-
* @property {Object} custom-style 自定义输入框的样式,对象形式
91-
* @property {Boolean} focus 是否自动获得焦点(默认false)
92-
* @property {Boolean} fixed 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false)
93-
* @property {Boolean} password-icon type为password时,是否显示右侧的密码查看图标(默认true)
94-
* @property {Boolean} border 是否显示边框(默认false)
95-
* @property {String} border-color 输入框的边框颜色(默认#dcdfe6)
96-
* @property {Boolean} auto-height 是否自动增高输入区域,type为textarea时有效(默认true)
97-
* @property {String Number} height 高度,单位rpx(text类型时为70,textarea时为100)
98-
* @example <u-input v-model="value" :type="type" :border="border" />
99-
*/
74+
/**
75+
* input 输入框
76+
* @description 此组件为一个输入框,默认没有边框和样式,是专门为配合表单组件u-form而设计的,利用它可以快速实现表单验证,输入内容,下拉选择等功能。
77+
* @tutorial http://uviewui.com/components/input.html
78+
* @property {String} type 模式选择,见官网说明
79+
* @property {Boolean} clearable 是否显示右侧的清除图标(默认true)
80+
* @property {} v-model 用于双向绑定输入框的值
81+
* @property {String} input-align 输入框文字的对齐方式(默认left)
82+
* @property {String} placeholder placeholder显示值(默认 '请输入内容')
83+
* @property {Boolean} disabled 是否禁用输入框(默认false)
84+
* @property {String Number} maxlength 输入框的最大可输入长度(默认140)
85+
* @property {String Number} selection-start 光标起始位置,自动聚焦时有效,需与selection-end搭配使用(默认-1)
86+
* @property {String Number} maxlength 光标结束位置,自动聚焦时有效,需与selection-start搭配使用(默认-1)
87+
* @property {String Number} cursor-spacing 指定光标与键盘的距离,单位px(默认0)
88+
* @property {String} placeholderStyle placeholder的样式,字符串形式,如"color: red;"(默认 "color: #c0c4cc;")
89+
* @property {String} confirm-type 设置键盘右下角按钮的文字,仅在type为text时生效(默认done)
90+
* @property {Object} custom-style 自定义输入框的样式,对象形式
91+
* @property {Boolean} focus 是否自动获得焦点(默认false)
92+
* @property {Boolean} fixed 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false)
93+
* @property {Boolean} password-icon type为password时,是否显示右侧的密码查看图标(默认true)
94+
* @property {Boolean} border 是否显示边框(默认false)
95+
* @property {String} border-color 输入框的边框颜色(默认#dcdfe6)
96+
* @property {Boolean} auto-height 是否自动增高输入区域,type为textarea时有效(默认true)
97+
* @property {String Number} height 高度,单位rpx(text类型时为70,textarea时为100)
98+
* @example <u-input v-model="value" :type="type" :border="border" />
99+
*/
100100
export default {
101101
name: 'u-input',
102102
mixins: [Emitter],

uview-ui/components/u-parse/libs/MpHtmlParser.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* html 解析器
33
* @tutorial https://github.com/jin-yufeng/Parser
4-
* @version 20200719
4+
* @version 20200728
55
* @author JinYufeng
66
* @listens MIT
77
*/
@@ -102,9 +102,16 @@ MpHtmlParser.prototype.setText = function() {
102102
}
103103
if (!this.pre) {
104104
// 合并空白符
105-
var tmp = [];
105+
var flag, tmp = [];
106106
for (let i = text.length, c; c = text[--i];)
107-
if (!blankChar[c] || (!blankChar[tmp[0]] && (c = ' '))) tmp.unshift(c);
107+
if (!blankChar[c]) {
108+
tmp.unshift(c);
109+
if (!flag) flag = 1;
110+
} else {
111+
if (tmp[0] != ' ') tmp.unshift(' ');
112+
if (c == '\n' && flag == void 0) flag = 0;
113+
}
114+
if (flag == 0) return;
108115
text = tmp.join('');
109116
}
110117
this.siblings().push({
@@ -119,6 +126,7 @@ MpHtmlParser.prototype.setNode = function() {
119126
attrs: this.attrs
120127
},
121128
close = cfg.selfClosingTags[node.name];
129+
if (this.options.nodes.length) node.type = 'node';
122130
this.attrs = {};
123131
if (!cfg.ignoreTags[node.name]) {
124132
// 处理属性
@@ -189,6 +197,7 @@ MpHtmlParser.prototype.setNode = function() {
189197
attrs.height = void 0;
190198
}
191199
}
200+
if (!attrs.controls && !attrs.autoplay) attrs.controls = 'T';
192201
attrs.source = [];
193202
if (attrs.src) {
194203
attrs.source.push(attrs.src);
@@ -217,8 +226,7 @@ MpHtmlParser.prototype.setNode = function() {
217226
if (info.length < 2) continue;
218227
let key = info[0].trim().toLowerCase(),
219228
value = info.slice(1).join(':').trim();
220-
if (value.includes('-webkit') || value.includes('-moz') || value.includes('-ms') || value.includes('-o') || value.includes(
221-
'safe'))
229+
if (value[0] == '-' || value.includes('safe'))
222230
style += `;${key}:${value}`;
223231
else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import'))
224232
styleObj[key] = value;
@@ -359,13 +367,6 @@ MpHtmlParser.prototype.popNode = function(node) {
359367
// 替换一些标签名
360368
if (cfg.blockTags[node.name]) node.name = 'div';
361369
else if (!cfg.trustTags[node.name]) node.name = 'span';
362-
// 去除块标签前后空串
363-
if (node.name == 'div' || node.name == 'p' || node.name[0] == 't') {
364-
if (len > 1 && siblings[len - 2].text == ' ')
365-
siblings.splice(--len - 1, 1);
366-
if (childs.length && childs[childs.length - 1].text == ' ')
367-
childs.pop();
368-
}
369370
// 处理列表
370371
if (node.c && (node.name == 'ul' || node.name == 'ol')) {
371372
if ((node.attrs.style || '').includes('list-style:none')) {

uview-ui/components/u-parse/libs/config.js

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* 配置文件 */
2-
// #ifdef MP-WEIXIN
3-
const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容
4-
// #endif
5-
module.exports = {
2+
var cfg = {
63
// 出错占位图
74
errorImg: null,
85
// 过滤器函数
@@ -32,41 +29,15 @@ module.exports = {
3229
blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
3330
boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
3431
// 块级标签,将被转为 div
35-
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + (
36-
// #ifdef MP-WEIXIN
37-
canIUse ? '' :
38-
// #endif
39-
',pre')),
32+
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
4033
// 将被移除的标签
41-
ignoreTags: makeMap(
42-
'area,base,canvas,frame,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'
43-
// #ifdef MP-WEIXIN
44-
+ (canIUse ? ',rp' : '')
45-
// #endif
46-
// #ifndef APP-PLUS
47-
+ ',iframe'
48-
// #endif
49-
),
34+
ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
5035
// 只能被 rich-text 显示的标签
51-
richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'
52-
// #ifdef MP-WEIXIN
53-
+ (canIUse ? ',bdi,bdo,caption,rt,ruby' : '')
54-
// #endif
55-
),
36+
richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'),
5637
// 自闭合的标签
57-
selfClosingTags: makeMap(
58-
'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
59-
),
38+
selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
6039
// 信任的标签
61-
trustTags: makeMap(
62-
'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
63-
// #ifdef MP-WEIXIN
64-
+ (canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '')
65-
// #endif
66-
// #ifdef APP-PLUS
67-
+ ',embed,iframe'
68-
// #endif
69-
),
40+
trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
7041
// 默认的标签样式
7142
userAgentStyles: {
7243
address: 'font-style:italic',
@@ -91,3 +62,19 @@ function makeMap(str) {
9162
map[list[i]] = true;
9263
return map;
9364
}
65+
66+
// #ifdef MP-WEIXIN
67+
if (wx.canIUse('editor')) {
68+
cfg.blockTags.pre = void 0;
69+
cfg.ignoreTags.rp = true;
70+
Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
71+
Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
72+
}
73+
// #endif
74+
75+
// #ifdef APP-PLUS
76+
cfg.ignoreTags.iframe = void 0;
77+
Object.assign(cfg.trustTags, makeMap('embed,iframe'));
78+
// #endif
79+
80+
module.exports = cfg;

uview-ui/components/u-parse/libs/trees.vue

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<block v-for="(n, i) in nodes" v-bind:key="i">
44
<!--图片-->
55
<view v-if="n.name=='img'" :class="'_img '+n.attrs.class" :style="n.attrs.style" :data-attrs="n.attrs" @tap="imgtap">
6-
<rich-text v-if="controls[i]!=0" :nodes="[{attrs:{src:loading&&(controls[i]||0)<2?loading:(lazyLoad&&!controls[i]?placeholder:(controls[i]==3?errorImg:n.attrs.src||'')),alt:n.attrs.alt||'',width:n.attrs.width||'',style:'-webkit-touch-callout:none;max-width:100%;display:block'+(n.attrs.height?';height:'+n.attrs.height:'')},name:'img'}]" />
7-
<image class="_image" :src="lazyLoad&&!controls[i]?placeholder:n.attrs.src" :lazy-load="lazyLoad"
6+
<rich-text v-if="ctrl[i]!=0" :nodes="[{attrs:{src:loading&&(ctrl[i]||0)<2?loading:(lazyLoad&&!ctrl[i]?placeholder:(ctrl[i]==3?errorImg:n.attrs.src||'')),alt:n.attrs.alt||'',width:n.attrs.width||'',style:'-webkit-touch-callout:none;max-width:100%;display:block'+(n.attrs.height?';height:'+n.attrs.height:'')},name:'img'}]" />
7+
<image class="_image" :src="lazyLoad&&!ctrl[i]?placeholder:n.attrs.src" :lazy-load="lazyLoad"
88
:show-menu-by-longpress="!n.attrs.ignore" :data-i="i" :data-index="n.attrs.i" data-source="img" @load="loadImg"
99
@error="error" />
1010
</view>
@@ -14,15 +14,15 @@
1414
<text v-else-if="n.name=='br'">\n</text>
1515
<!--#endif-->
1616
<!--视频-->
17-
<view v-else-if="((n.lazyLoad&&!n.attrs.autoplay)||(n.name=='video'&&!loadVideo))&&controls[i]==undefined" :id="n.attrs.id" :class="'_video '+(n.attrs.class||'')"
17+
<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||'')"
1818
:style="n.attrs.style" :data-i="i" @tap="_loadVideo" />
19-
<video v-else-if="n.name=='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||controls[i]==0"
20-
:controls="!n.attrs.autoplay||n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[controls[i]||0]"
19+
<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"
20+
:controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[ctrl[i]||0]"
2121
:unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" :data-i="i" data-source="video" @error="error" @play="play" />
2222
<!--音频-->
2323
<audio v-else-if="n.name=='audio'" :ref="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author"
24-
:autoplay="n.attrs.autoplay" :controls="!n.attrs.autoplay||n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster"
25-
:src="n.attrs.source[controls[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio"
24+
:autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster"
25+
:src="n.attrs.source[ctrl[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio"
2626
@error.native="error" @play.native="play" />
2727
<!--链接-->
2828
<view v-else-if="n.name=='a'" :id="n.attrs.id" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
@@ -32,7 +32,7 @@
3232
<!--广告-->
3333
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :unit-id="n.attrs['unit-id']" :appid="n.attrs.appid" :apid="n.attrs.apid" :type="n.attrs.type" :adpid="n.attrs.adpid" data-source="ad" @error="error" />-->
3434
<!--列表-->
35-
<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex'">
35+
<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex;flex-direction:row'">
3636
<view v-if="n.type=='ol'" class="_ol-bef">{{n.num}}</view>
3737
<view v-else class="_ul-bef">
3838
<view v-if="n.floor%3==0" class="_ul-p1">█</view>
@@ -80,7 +80,7 @@
8080
name: 'trees',
8181
data() {
8282
return {
83-
controls: [],
83+
ctrl: [],
8484
placeholder: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="225"/>',
8585
errorImg,
8686
loadVideo: typeof plus == 'undefined',
@@ -124,7 +124,7 @@
124124
if (res.intersectionRatio) {
125125
for (var j = this.nodes.length; j--;)
126126
if (this.nodes[j].name == 'img')
127-
this.$set(this.controls, j, 1);
127+
this.$set(this.ctrl, j, 1);
128128
this.observer.disconnect();
129129
}
130130
})
@@ -184,23 +184,23 @@
184184
},
185185
loadImg(e) {
186186
var i = e.currentTarget.dataset.i;
187-
if (this.lazyLoad && !this.controls[i]) {
187+
if (this.lazyLoad && !this.ctrl[i]) {
188188
// #ifdef QUICKAPP-WEBVIEW
189-
this.$set(this.controls, i, 0);
189+
this.$set(this.ctrl, i, 0);
190190
this.$nextTick(function() {
191191
// #endif
192192
// #ifndef APP-PLUS
193-
this.$set(this.controls, i, 1);
193+
this.$set(this.ctrl, i, 1);
194194
// #endif
195195
// #ifdef QUICKAPP-WEBVIEW
196196
})
197197
// #endif
198-
} else if (this.loading && this.controls[i] != 2) {
198+
} else if (this.loading && this.ctrl[i] != 2) {
199199
// #ifdef QUICKAPP-WEBVIEW
200-
this.$set(this.controls, i, 0);
200+
this.$set(this.ctrl, i, 0);
201201
this.$nextTick(function() {
202202
// #endif
203-
this.$set(this.controls, i, 2);
203+
this.$set(this.ctrl, i, 2);
204204
// #ifdef QUICKAPP-WEBVIEW
205205
})
206206
// #endif
@@ -258,14 +258,14 @@
258258
i = target.dataset.i;
259259
if (source == 'video' || source == 'audio') {
260260
// 加载其他 source
261-
var index = this.controls[i] ? this.controls[i].i + 1 : 1;
261+
var index = this.ctrl[i] ? this.ctrl[i].i + 1 : 1;
262262
if (index < this.nodes[i].attrs.source.length)
263-
this.$set(this.controls, i, index);
263+
this.$set(this.ctrl, i, index);
264264
if (e.detail.__args__)
265265
e.detail = e.detail.__args__[0];
266266
} else if (errorImg && source == 'img') {
267267
this.top.imgList.setItem(target.dataset.index, errorImg);
268-
this.$set(this.controls, i, 3);
268+
this.$set(this.ctrl, i, 3);
269269
}
270270
this.top && this.top.$emit('error', {
271271
source,
@@ -274,7 +274,7 @@
274274
});
275275
},
276276
_loadVideo(e) {
277-
this.$set(this.controls, e.target.dataset.i, 0);
277+
this.$set(this.ctrl, e.target.dataset.i, 0);
278278
}
279279
}
280280
}
@@ -407,12 +407,13 @@
407407
}
408408
409409
._ul-bef {
410+
display: block;
410411
margin: 0 12px 0 23px;
411412
line-height: normal;
412413
}
413414
414415
._ol-bef,
415-
._ul_bef {
416+
._ul-bef {
416417
flex: none;
417418
user-select: none;
418419
}

uview-ui/components/u-parse/u-parse.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
* @event {Function} imgtap 图片点击事件
6464
* @event {Function} linkpress 链接点击事件
6565
* @author JinYufeng
66-
* @version 20200719
66+
* @version 20200728
6767
* @listens MIT
6868
*/
6969
export default {

0 commit comments

Comments
 (0)