Commit 3d74f395 authored by wlxuqu's avatar wlxuqu

1. 【新增】新增parse富文本解析器组件

2. 【新增】新增$u.test.object()方法用于判断是否对象
3. 【新增】新增$u.test.jsonString()方法用于判断是否json字符串
4. 【新增】line-progress线性进度条新增默认slot,可传入自定义内容
5. 【新增】popup弹窗组件新增mask-custom-style参数,用于修改遮罩的透明度等样式
6. 【新增】新增判断固定电话规则$u.test.landline()
7. 【新增】u-image新增bg-color参数,可以设置加载中阶段的背景颜色
8. 【新增】u-search在disabled为true时,点击可以发出click事件,用于跳转
9. 【新增】新增$u.test.array()方法用于判断是否数组
10. 【优化】同步升级parse到最新版本
11. 【优化】优化field组件使用right插槽时内容和清除图标距离太近的问题
12. 【修复】修复picker和select点击确定时,收起动画无效的问题
13. 【修复】修复number-box步进器组件连续输入多个数值,可能会导致内存溢出的问题
14. 【修复】修复支付宝小程序上tabs组件无效的问题
15. 【修复】修复swipeAction组件在支付宝小程序无效的问题
16. 【修复】修复table对支付宝的兼容问题,废弃table的单元格合并模式,详见官网升级指南
17. 【修复】修复index-list组件,全面兼容支付宝小程序
18. 【修复】修复keyboard组件z-index参数无效的问题
19. 【修复】修复readmore组件示例在支付宝小程序无效的问题
20. 【修复】修复picker组件start-year和end-year传递字符串类型无效的问题
21. 【修复】修复瀑布流组件的modify方法可能会导致数据错乱的问题
22. 【修复】修复H5端popup等弹出组件层级比uni.showToast()的层级高的问题
23. 【修复】修复modal组件异步关闭模式,可能无法清除loading的问题
parent b052555b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name" : "uView", "name" : "uView",
"appid" : "__UNI__60F4B81", "appid" : "__UNI__60F4B81",
"description" : "多平台快速开发的UI框架", "description" : "多平台快速开发的UI框架",
"versionName" : "1.5.3", "versionName" : "1.5.4",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
...@@ -106,7 +106,8 @@ ...@@ -106,7 +106,8 @@
"usingComponents" : true "usingComponents" : true
}, },
"mp-alipay" : { "mp-alipay" : {
"usingComponents" : true "usingComponents" : true,
"component2": true
}, },
"mp-baidu" : { "mp-baidu" : {
"usingComponents" : true, "usingComponents" : true,
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"easycom": { "easycom": {
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
}, },
"condition": { //模式配置,仅开发期间生效 // "condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项) // "current": 0, //当前激活的模式(list 的索引项)
"list": [{ // "list": [{
"name": "test", //模式名称 // "name": "test", //模式名称
"path": "pages/componentsB/readMore/index", //启动页面,必选 // "path": "pages/componentsB/table/index", //启动页面,必选
"query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到 // "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
}] // }]
}, // },
"pages": [ "pages": [
// 演示-组件 // 演示-组件
{ {
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
<view class="u-demo-title">演示效果</view> <view class="u-demo-title">演示效果</view>
<view class="u-demo-area"> <view class="u-demo-area">
<u-toast ref="uToast"></u-toast> <u-toast ref="uToast"></u-toast>
<u-table :align="align" :borderColor="borderColor" :style="{ <u-table :align="align" :borderColor="borderColor">
display: !mode ? 'block' : 'none'
}">
<u-tr> <u-tr>
<u-th>姓名</u-th> <u-th>姓名</u-th>
<u-th>年龄</u-th> <u-th>年龄</u-th>
...@@ -32,56 +30,12 @@ ...@@ -32,56 +30,12 @@
<u-td></u-td> <u-td></u-td>
</u-tr> </u-tr>
</u-table> </u-table>
<u-table :align="align" :borderColor="borderColor" :style="{
display: mode ? 'block' : 'none'
}">
<u-tr>
<u-th>姓名</u-th>
<u-th>年龄</u-th>
<u-th>籍贯</u-th>
<u-th>性别</u-th>
</u-tr>
<u-tr>
<u-td width="25%">吕布</u-td>
<u-td>
<u-tr>
<u-td>28</u-td>
<u-td>楚河</u-td>
<u-td></u-td>
</u-tr>
<u-tr>
<u-td>28</u-td>
<u-td>楚河</u-td>
<u-td></u-td>
</u-tr>
</u-td>
</u-tr>
<u-tr>
<u-td width="50%">项羽</u-td>
<u-td>
<u-tr>
<u-td>汉界</u-td>
<u-td></u-td>
</u-tr>
</u-td>
</u-tr>
<u-tr>
<u-td>木兰</u-td>
<u-td>24</u-td>
<u-td>南国</u-td>
<u-td></u-td>
</u-tr>
</u-table>
</view> </view>
</view> </view>
<view class="u-config-wrap"> <view class="u-config-wrap">
<view class="u-config-title u-border-bottom"> <view class="u-config-title u-border-bottom">
参数配置 参数配置
</view> </view>
<view class="u-config-item">
<view class="u-item-title">合并单元格(微信小程序不支持合并)</view>
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="modeChange"></u-subsection>
</view>
<view class="u-config-item"> <view class="u-config-item">
<view class="u-item-title">边框颜色</view> <view class="u-item-title">边框颜色</view>
<u-subsection vibrateShort :list="['gray', 'primary', 'warning']" @change="borderColorChange"></u-subsection> <u-subsection vibrateShort :list="['gray', 'primary', 'warning']" @change="borderColorChange"></u-subsection>
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
this.step = index == 0 ? 1 : index == 1 ? 3 : index == 2 ? 5 : 8; this.step = index == 0 ? 1 : index == 1 ? 3 : index == 2 ? 5 : 8;
}, },
change(e) { change(e) {
console.log(this.value); //console.log(e.value);
} }
} }
}; };
......
...@@ -197,11 +197,15 @@ export default [{ ...@@ -197,11 +197,15 @@ export default [{
path: '/pages/componentsB/sticky/index', path: '/pages/componentsB/sticky/index',
icon: 'sticky', icon: 'sticky',
title: 'Sticky 吸顶', title: 'Sticky 吸顶',
}, { },
// #ifndef MP-ALIPAY
{
path: '/pages/componentsB/waterfall/index', path: '/pages/componentsB/waterfall/index',
icon: 'waterfall', icon: 'waterfall',
title: 'Waterfall 瀑布流', title: 'Waterfall 瀑布流',
}, { },
// #endif
{
path: '/pages/componentsB/divider/index', path: '/pages/componentsB/divider/index',
icon: 'divider', icon: 'divider',
title: 'Divider 分割线', title: 'Divider 分割线',
...@@ -224,11 +228,15 @@ export default [{ ...@@ -224,11 +228,15 @@ export default [{
path: '/pages/componentsA/tabs/index', path: '/pages/componentsA/tabs/index',
icon: 'tabs', icon: 'tabs',
title: 'Tabs 标签', title: 'Tabs 标签',
}, { },
// #ifndef MP-ALIPAY
{
path: '/pages/template/order/index', path: '/pages/template/order/index',
icon: 'tabsSwiper', icon: 'tabsSwiper',
title: 'TabsSwiper 全屏选项卡', title: 'TabsSwiper 全屏选项卡',
}, { },
// #endif
{
path: '/pages/componentsC/subsection/index', path: '/pages/componentsC/subsection/index',
icon: 'subsection', icon: 'subsection',
title: 'Subsection 分段器', title: 'Subsection 分段器',
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
return 'https://cdn.uviewui.com/uview/example/' + path + '.png'; return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
} }
} }
},
created() {
}, },
methods: { methods: {
openPage(path) { openPage(path) {
......
<template> <template>
<!-- 支付宝小程序使用$u.getRect()获取组件的根元素尺寸,所以在外面套一个"壳" -->
<view>
<view class="u-index-anchor-wrapper" :id="$u.guid()" :style="[wrapperStyle]"> <view class="u-index-anchor-wrapper" :id="$u.guid()" :style="[wrapperStyle]">
<view class="u-index-anchor " :class="[active ? 'u-index-anchor--active' : '']" :style="[customAnchorStyle]"> <view class="u-index-anchor " :class="[active ? 'u-index-anchor--active' : '']" :style="[customAnchorStyle]">
<slot v-if="useSlot" /> <slot v-if="useSlot" />
...@@ -7,6 +9,7 @@ ...@@ -7,6 +9,7 @@
</block> </block>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
......
<template> <template>
<!-- 支付宝小程序使用$u.getRect()获取组件的根元素尺寸,所以在外面套一个"壳" -->
<view>
<view class="u-index-bar"> <view class="u-index-bar">
<slot /> <slot />
<view v-if="showSidebar" class="u-index-bar__sidebar" @touchstart.stop.prevent="onTouchMove" @touchmove.stop.prevent="onTouchMove" <view v-if="showSidebar" class="u-index-bar__sidebar" @touchstart.stop.prevent="onTouchMove" @touchmove.stop.prevent="onTouchMove"
...@@ -14,6 +16,7 @@ ...@@ -14,6 +16,7 @@
<text>{{indexList[touchmoveIndex]}}</text> <text>{{indexList[touchmoveIndex]}}</text>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
......
<template> <template>
<u-popup class="" :mask="mask" :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto" <u-popup class="" :mask="mask" :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose"> :safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose" :zIndex="uZIndex">
<slot /> <slot />
<view class="u-tooltip" v-if="tooltip"> <view class="u-tooltip" v-if="tooltip">
<view class="u-tooltip-item u-tooltip-cancel" hover-class="u-tooltip-cancel-hover" @tap="onCancel"> <view class="u-tooltip-item u-tooltip-cancel" hover-class="u-tooltip-cancel-hover" @tap="onCancel">
......
...@@ -8,7 +8,11 @@ ...@@ -8,7 +8,11 @@
type ? `u-type-${type}-bg` : '', type ? `u-type-${type}-bg` : '',
striped ? 'u-striped' : '', striped ? 'u-striped' : '',
striped && stripedActive ? 'u-striped-active' : '' striped && stripedActive ? 'u-striped-active' : ''
]" class="u-active" :style="[progressStyle]">{{showPercent ? percent + '%' : ''}} ]" class="u-active" :style="[progressStyle]">
<slot v-if="$slots.default" />
<block v-else-if="showPercent">
{{percent + '%'}}
</block>
</view> </view>
</view> </view>
</template> </template>
......
...@@ -132,10 +132,6 @@ ...@@ -132,10 +132,6 @@
} }
}, },
watch: { watch: {
value(val, val1) {
// 防止用户在change事件回调中将回调值赋值给valut变量,导致change事件触发两次
if(Number(val) != this.inputVal) this.inputVal = Number(val);
},
inputVal(v1, v2) { inputVal(v1, v2) {
// 为了让用户能够删除所有输入值,重新输入内容,删除所有值后,内容为空字符串 // 为了让用户能够删除所有输入值,重新输入内容,删除所有值后,内容为空字符串
if (v1 == '') return; if (v1 == '') return;
...@@ -144,10 +140,8 @@ ...@@ -144,10 +140,8 @@
let tmp = this.$u.test.number(v1); let tmp = this.$u.test.number(v1);
if (tmp && v1 >= this.min && v1 <= this.max) value = v1; if (tmp && v1 >= this.min && v1 <= this.max) value = v1;
else value = v2; else value = v2;
// 发出change事件
this.handleChange(value, 'change'); this.handleChange(value, 'change');
this.$nextTick(() => {
this.inputVal = v1;
})
} }
}, },
data() { data() {
...@@ -258,7 +252,6 @@ ...@@ -258,7 +252,6 @@
this.$nextTick(() => { this.$nextTick(() => {
this.inputVal = val; this.inputVal = val;
}) })
this.handleChange(val, "blur");
}, },
handleChange(value, type) { handleChange(value, type) {
if (this.disabled) return; if (this.disabled) return;
......
/** /**
* html 解析器 * html 解析器
* @tutorial https://github.com/jin-yufeng/Parser * @tutorial https://github.com/jin-yufeng/Parser
* @version 20200712 * @version 20200719
* @author JinYufeng * @author JinYufeng
* @listens MIT * @listens MIT
*/ */
...@@ -233,8 +233,6 @@ MpHtmlParser.prototype.setNode = function() { ...@@ -233,8 +233,6 @@ MpHtmlParser.prototype.setNode = function() {
style += ';-webkit-touch-callout:none'; style += ';-webkit-touch-callout:none';
styleObj['max-width'] = '100%'; styleObj['max-width'] = '100%';
} }
if (!styleObj.position)
styleObj.top = styleObj.bottom = styleObj.left = styleObj.right = styleObj['z-index'] = void 0;
var width; var width;
if (styleObj.width) width = styleObj.width; if (styleObj.width) width = styleObj.width;
else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : attrs.width + 'px'; else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : attrs.width + 'px';
...@@ -305,7 +303,7 @@ MpHtmlParser.prototype.remove = function(node) { ...@@ -305,7 +303,7 @@ MpHtmlParser.prototype.remove = function(node) {
if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src; if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src;
var i = j; var i = j;
while (this.data[j] != '<') j--; while (this.data[j] != '<') j--;
src = this.data.substring(j, i) + src; src = this.data.substring(j, i).replace("viewbox", "viewBox") + src;
var parent = this.parent(); var parent = this.parent();
if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline')) if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline'))
parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style; parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
......
<template> <template>
<view class="interlayer"> <view :class="'interlayer '+(c||'')" :style="s">
<block v-for="(n, i) in nodes" v-bind:key="i"> <block v-for="(n, i) in nodes" v-bind:key="i">
<!--图片--> <!--图片-->
<view v-if="n.name=='img'" :class="'_img '+n.attrs.class" :style="n.attrs.style" :data-attrs="n.attrs" @tap="imgtap"> <view v-if="n.name=='img'" :class="'_img '+n.attrs.class" :style="n.attrs.style" :data-attrs="n.attrs" @tap="imgtap">
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<!--链接--> <!--链接-->
<view v-else-if="n.name=='a'" :id="n.attrs.id" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style" <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"> :data-attrs="n.attrs" @tap="linkpress">
<trees class="_span" :nodes="n.children" /> <trees class="_span" c="_span" :nodes="n.children" />
</view> </view>
<!--广告--> <!--广告-->
<!--<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" />--> <!--<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" />-->
...@@ -39,31 +39,15 @@ ...@@ -39,31 +39,15 @@
<view v-else-if="n.floor%3==2" class="_ul-p2" /> <view v-else-if="n.floor%3==2" class="_ul-p2" />
<view v-else class="_ul-p1" style="border-radius:50%"></view> <view v-else class="_ul-p1" style="border-radius:50%"></view>
</view> </view>
<!--#ifdef MP-ALIPAY--> <trees class="_li" c="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
<view class="_li">
<trees :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
</view>
<!--#endif-->
<!--#ifndef MP-ALIPAY-->
<trees class="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
<!--#endif-->
</view> </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-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="(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'):'')"> <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'):'')">
<trees v-if="tr.name=='td'" :nodes="tr.children" /> <trees v-if="tr.name=='td'" :nodes="tr.children" />
<block v-else> <trees v-else v-for="(td, q) in tr.children" v-bind:key="q" :class="td.attrs.class" :c="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
<!--#ifdef MP-ALIPAY--> :s="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')" :nodes="td.children" />
<view v-for="(td, q) in tr.children" v-bind:key="q" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')">
<trees :nodes="td.children" />
</view>
<!--#endif-->
<!--#ifndef MP-ALIPAY-->
<trees v-for="(td, q) in tr.children" v-bind:key="q" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
:nodes="td.children" />
<!--#endif-->
</block>
</view> </view>
</view> </view>
</view> </view>
...@@ -79,15 +63,8 @@ ...@@ -79,15 +63,8 @@
<!--#ifndef MP-WEIXIN || MP-QQ || APP-PLUS--> <!--#ifndef MP-WEIXIN || MP-QQ || APP-PLUS-->
<rich-text v-else-if="!n.c" :id="n.attrs.id" :nodes="[n]" style="display:inline" /> <rich-text v-else-if="!n.c" :id="n.attrs.id" :nodes="[n]" style="display:inline" />
<!--#endif--> <!--#endif-->
<!--#ifdef MP-ALIPAY--> <trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :c="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')"
<view v-else :id="n.attrs.id" :class="'_'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style"> :style="n.attrs.style" :s="n.attrs.style" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
<trees :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
</view>
<!--#endif-->
<!--#ifndef MP-ALIPAY-->
<trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style" :nodes="n.children"
:lazyLoad="lazyLoad" :loading="loading" />
<!--#endif-->
</block> </block>
</view> </view>
</template> </template>
...@@ -106,19 +83,21 @@ ...@@ -106,19 +83,21 @@
controls: [], controls: [],
placeholder: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="225"/>', placeholder: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="225"/>',
errorImg, errorImg,
loadVideo: loadVideo: typeof plus == 'undefined',
// #ifdef APP-PLUS // #ifndef MP-ALIPAY
false c: '',
// #endif s: ''
// #ifndef APP-PLUS
true
// #endif // #endif
} }
}, },
props: { props: {
nodes: Array, nodes: Array,
lazyLoad: Boolean, lazyLoad: Boolean,
loading: String loading: String,
// #ifdef MP-ALIPAY
c: String,
s: String
// #endif
}, },
mounted() { mounted() {
for (this.top = this.$parent; this.top.$options.name != 'parser'; this.top = this.top.$parent); for (this.top = this.$parent; this.top.$options.name != 'parser'; this.top = this.top.$parent);
...@@ -140,7 +119,7 @@ ...@@ -140,7 +119,7 @@
top: 500, top: 500,
bottom: 500 bottom: 500
}); });
this.$nextTick(() => { setTimeout(() => {
this.observer.observe('._img', res => { this.observer.observe('._img', res => {
if (res.intersectionRatio) { if (res.intersectionRatio) {
for (var j = this.nodes.length; j--;) for (var j = this.nodes.length; j--;)
...@@ -149,7 +128,7 @@ ...@@ -149,7 +128,7 @@
this.observer.disconnect(); this.observer.disconnect();
} }
}) })
}) }, 0)
} }
// #endif // #endif
} else if (n.name == 'video' || n.name == 'audio') { } else if (n.name == 'video' || n.name == 'audio') {
...@@ -318,9 +297,9 @@ ...@@ -318,9 +297,9 @@
} }
._img { ._img {
position: relative;
display: inline-block; display: inline-block;
max-width: 100%; max-width: 100%;
overflow: hidden;
} }
/* #ifdef MP-WEIXIN */ /* #ifdef MP-WEIXIN */
...@@ -330,7 +309,7 @@ ...@@ -330,7 +309,7 @@
/* #endif */ /* #endif */
/* #ifdef MP || QUICKAPP-WEBVIEW */ /* #ifndef MP-ALIPAY || APP-PLUS */
.interlayer { .interlayer {
display: inherit; display: inherit;
flex-direction: inherit; flex-direction: inherit;
...@@ -349,6 +328,7 @@ ...@@ -349,6 +328,7 @@
font-weight: bold; font-weight: bold;
} }
/* #ifndef MP-ALIPAY */
._blockquote, ._blockquote,
._div, ._div,
._p, ._p,
...@@ -358,6 +338,8 @@ ...@@ -358,6 +338,8 @@
display: block; display: block;
} }
/* #endif */
._code { ._code {
font-family: monospace; font-family: monospace;
} }
...@@ -402,11 +384,10 @@ ...@@ -402,11 +384,10 @@
} }
._image { ._image {
position: absolute; display: block;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 360px;
margin-top: -360px;
opacity: 0; opacity: 0;
} }
...@@ -470,7 +451,7 @@ ...@@ -470,7 +451,7 @@
vertical-align: super; vertical-align: super;
} }
/* #ifdef MP-ALIPAY || APP-PLUS || QUICKAPP-WEBVIEW*/ /* #ifdef MP-ALIPAY || APP-PLUS || QUICKAPP-WEBVIEW */
._abbr, ._abbr,
._b, ._b,
._code, ._code,
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
} }
// #endif // #endif
// #ifdef H5 || APP-PLUS-NVUE || MP-360 // #ifdef H5 || APP-PLUS-NVUE || MP-360
var rpx = uni.getSystemInfoSync().windowWidth / 750, var windowWidth = uni.getSystemInfoSync().windowWidth,
cfg = require('./libs/config.js'); cfg = require('./libs/config.js');
// #endif // #endif
// #ifdef APP-PLUS-NVUE // #ifdef APP-PLUS-NVUE
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
* @event {Function} imgtap 图片点击事件 * @event {Function} imgtap 图片点击事件
* @event {Function} linkpress 链接点击事件 * @event {Function} linkpress 链接点击事件
* @author JinYufeng * @author JinYufeng
* @version 20200712 * @version 20200719
* @listens MIT * @listens MIT
*/ */
export default { export default {
...@@ -219,13 +219,13 @@ ...@@ -219,13 +219,13 @@
this.$refs.web.evalJs("document.write('" + html.replace(/'/g, "\\'") + "');document.close()"); this.$refs.web.evalJs("document.write('" + html.replace(/'/g, "\\'") + "');document.close()");
} }
this.$refs.web.evalJs( this.$refs.web.evalJs(
'var t=document.getElementsByTagName("title");t.length&&e({action:"getTitle",title:t[0].innerText});for(var o,n=document.getElementsByTagName("style"),r=1;o=n[r++];)o.innerHTML=o.innerHTML.replace(/body/g,"#parser");for(var i,a,c=document.getElementsByTagName("img"),s=[],d=0,l=0,g=0;a=c[l];l++)a.onload=function(){++d==c.length&&(i=!0,e({action:"ready"}))},a.onerror=function(){' + 'var t=document.getElementsByTagName("title");t.length&&e({action:"getTitle",title:t[0].innerText});for(var o,n=document.getElementsByTagName("style"),r=1;o=n[r++];)o.innerHTML=o.innerHTML.replace(/body/g,"#parser");for(var a,c=document.getElementsByTagName("img"),s=[],i=0==c.length,d=0,l=0,g=0;a=c[l];l++)parseInt(a.style.width||a.getAttribute("width"))>' +
(cfg.errorImg ? 'this.src="' + cfg.errorImg + '",' : '') + windowWidth + '&&(a.style.height="auto"),a.onload=function(){++d==c.length&&(i=!0)},a.onerror=function(){++d==c.length&&(i=!0),' + (cfg.errorImg ? 'this.src="' + cfg.errorImg + '",' : '') +
'e({action:"error",source:"img",target:this})},a.hasAttribute("ignore")||"A"==a.parentElement.nodeName||(a.i=g++,s.push(a.src),a.onclick=function(){e({action:"preview",img:{i:this.i,src:this.src}})});e({action:"getImgList",imgList:s});for(var u,m=document.getElementsByTagName("a"),f=0;u=m[f];f++)u.onclick=function(){var t,o=this.getAttribute("href");if("#"==o[0]){var n=document.getElementById(o.substr(1));n&&(t=n.offsetTop)}return e({action:"linkpress",href:o,offset:t}),!1};for(var h,y=document.getElementsByTagName("video"),v=0;h=y[v];v++)h.style.maxWidth="100%",h.onerror=function(){e({action:"error",source:"video",target:this})}' + 'e({action:"error",source:"img",target:this})},a.hasAttribute("ignore")||"A"==a.parentElement.nodeName||(a.i=g++,s.push(a.src),a.onclick=function(){e({action:"preview",img:{i:this.i,src:this.src}})});e({action:"getImgList",imgList:s});for(var u,m=document.getElementsByTagName("a"),f=0;u=m[f];f++)u.onclick=function(){var t,o=this.getAttribute("href");if("#"==o[0]){var n=document.getElementById(o.substr(1));n&&(t=n.offsetTop)}return e({action:"linkpress",href:o,offset:t}),!1};for(var h,y=document.getElementsByTagName("video"),v=0;h=y[v];v++)h.style.maxWidth="100%",h.onerror=function(){e({action:"error",source:"video",target:this})}' +
(this.autopause ? ',h.onplay=function(){for(var e,t=0;e=y[t];t++)e!=this&&e.pause()}' : '') + (this.autopause ? ',h.onplay=function(){for(var e,t=0;e=y[t];t++)e!=this&&e.pause()}' : '') +
';for(var _,p=document.getElementsByTagName("audio"),w=0;_=p[w];w++)_.onerror=function(){e({action:"error",source:"audio",target:this})};' + ';for(var _,p=document.getElementsByTagName("audio"),w=0;_=p[w];w++)_.onerror=function(){e({action:"error",source:"audio",target:this})};' +
(this.autoscroll ? 'for(var T,E=document.getElementsByTagName("table"),B=0;T=E[B];B++){var N=document.createElement("div");N.style.overflow="scroll",T.parentNode.replaceChild(N,T),N.appendChild(T)}' : '') + (this.autoscroll ? 'for(var T,E=document.getElementsByTagName("table"),B=0;T=E[B];B++){var N=document.createElement("div");N.style.overflow="scroll",T.parentNode.replaceChild(N,T),N.appendChild(T)}' : '') +
'var x=document.getElementById("parser"),b=setInterval(function(){i&&clearInterval(b),e({action:"height",height:x.scrollHeight})},350)' 'var x=document.getElementById("parser");clearInterval(window.timer),window.timer=setInterval(function(){i&&clearInterval(window.timer),e({action:"ready",ready:i,height:x.scrollHeight})},350)'
) )
this.nodes = [1]; this.nodes = [1];
// #endif // #endif
...@@ -272,6 +272,8 @@ ...@@ -272,6 +272,8 @@
this.imgList.length = 0; this.imgList.length = 0;
var imgs = this.rtf.getElementsByTagName('img'); var imgs = this.rtf.getElementsByTagName('img');
for (let i = 0, j = 0, img; img = imgs[i]; i++) { for (let i = 0, j = 0, img; img = imgs[i]; i++) {
if (parseInt(img.style.width || img.getAttribute('width')) > windowWidth)
img.style.height = 'auto';
var src = img.getAttribute('src'); var src = img.getAttribute('src');
if (this.domain && src) { if (this.domain && src) {
if (src[0] == '/') { if (src[0] == '/') {
...@@ -525,7 +527,7 @@ ...@@ -525,7 +527,7 @@
} }
// 处理 rpx // 处理 rpx
if (html.includes('rpx')) if (html.includes('rpx'))
html = html.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * rpx + 'px'); html = html.replace(/[0-9.]+\s*rpx/g, $ => (parseFloat($) * windowWidth / 750) + 'px');
return html; return html;
}, },
// #endif // #endif
...@@ -590,14 +592,12 @@ ...@@ -590,14 +592,12 @@
}) })
break; break;
case 'ready': case 'ready':
uni.createSelectorQuery().in(this).select('#_top').boundingClientRect().exec(res => { this.height = d.height;
if (d.ready) uni.createSelectorQuery().in(this).select('#_top').boundingClientRect().exec(res => {
this.rect = res[0]; this.rect = res[0];
this.$emit('ready', res[0]); this.$emit('ready', res[0]);
}) })
break; break;
case 'height':
this.height = d.height;
break;
case 'click': case 'click':
this.$emit('click'); this.$emit('click');
this.$emit('tap'); this.$emit('tap');
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view v-if="visibleSync" :style="[customStyle, { <view v-if="visibleSync" :style="[customStyle, {
zIndex: uZindex - 1 zIndex: uZindex - 1
}]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer"> }]" :class="{ 'u-drawer-visible': showDrawer }" class="u-drawer">
<u-mask :maskClickAble="maskCloseAble" :z-index="uZindex - 2" :show="showDrawer && mask" @click="maskClick"></u-mask> <u-mask :custom-style="maskCustomStyle" :maskClickAble="maskCloseAble" :z-index="uZindex - 2" :show="showDrawer && mask" @click="maskClick"></u-mask>
<view <view
class="u-drawer-content" class="u-drawer-content"
@tap="modeCenterClose(mode)" @tap="modeCenterClose(mode)"
...@@ -182,6 +182,13 @@ export default { ...@@ -182,6 +182,13 @@ export default {
negativeTop: { negativeTop: {
type: [String, Number], type: [String, Number],
default: 0 default: 0
},
// 遮罩的样式,一般用于修改遮罩的透明度
maskCustomStyle: {
type: Object,
default() {
return {}
}
} }
}, },
data() { data() {
......
<template> <template>
<view class="">
<movable-area class="u-swipe-action" :style="{ backgroundColor: bgColor }"> <movable-area class="u-swipe-action" :style="{ backgroundColor: bgColor }">
<movable-view <movable-view
class="u-swipe-view" class="u-swipe-view"
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
</view> </view>
</movable-view> </movable-view>
</movable-area> </movable-area>
</view>
</template> </template>
<script> <script>
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
provide() { provide() {
return { return {
uTable: this, uTable: this,
uTd: this
}; };
}, },
data() { data() {
......
<template> <template>
<view class="u-tabs" :id="id" :style="{ <view class="u-tabs" :style="{
background: bgColor background: bgColor
}"> }">
<!-- $u.getRect()对组件根节点无效,因为写了.in(this),故这里获取内层接点尺寸 -->
<view :id="id">
<scroll-view scroll-x class="u-scroll-view" :scroll-left="scrollLeft" scroll-with-animation> <scroll-view scroll-x class="u-scroll-view" :scroll-left="scrollLeft" scroll-with-animation>
<view class="u-scroll-box" :class="{'u-tabs-scorll-flex': !isScroll}"> <view class="u-scroll-box" :class="{'u-tabs-scorll-flex': !isScroll}">
<view class="u-tab-item" :id="'u-tab-item-' + index" v-for="(item, index) in list" :key="index" @tap="clickTab(index)" <view class="u-tab-item" :id="'u-tab-item-' + index" v-for="(item, index) in list" :key="index" @tap="clickTab(index)"
...@@ -12,6 +14,7 @@ ...@@ -12,6 +14,7 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</view>
</template> </template>
<script> <script>
......
...@@ -21,34 +21,20 @@ ...@@ -21,34 +21,20 @@
default: 'auto' default: 'auto'
} }
}, },
data() { inject: ['uTable'],
return {
};
},
inject: ['uTable', 'uTr'],
provide() {
return {
uTd: this
}
},
created() {
// 定义在created中,避免微信小程序造成循环引用而报错
this.tr = []
},
computed: { computed: {
tdStyle() { tdStyle() {
let style = {}; let style = {};
if (this.width != "auto") style.flex = `0 0 ${this.width}`; if (this.width != "auto") style.flex = `0 0 ${this.width}`;
style.textAlign = this.uTable.align; style.textAlign = this.uTable.align;
style.padding = this.tr.length == 0 ? this.uTable.padding : 0;
style.borderBottom = this.tr.length == 0 ? `solid 1px ${this.uTable.borderColor}` : 0;
style.borderRight = this.tr.length == 0 ? `solid 1px ${this.uTable.borderColor}` : 0;
style.fontSize = this.uTable.fontSize + 'rpx'; style.fontSize = this.uTable.fontSize + 'rpx';
style.padding = this.uTable.padding;
style.borderBottom = `solid 1px ${this.uTable.borderColor}`;
style.borderRight = `solid 1px ${this.uTable.borderColor}`;
style.color = this.uTable.color; style.color = this.uTable.color;
return style; return style;
} }
} },
}; };
</script> </script>
......
...@@ -21,11 +21,6 @@ ...@@ -21,11 +21,6 @@
default: '' default: ''
} }
}, },
data() {
return {
};
},
inject: ['uTable'], inject: ['uTable'],
computed: { computed: {
thStyle() { thStyle() {
......
...@@ -13,17 +13,6 @@ ...@@ -13,17 +13,6 @@
*/ */
export default { export default {
name: "u-tr", name: "u-tr",
inject: ['uTable', 'uTd'],
provide() {
return {
uTr: this,
};
},
created() {
if (this.uTd && this.uTd.tr) {
this.uTd.tr.push(this);
}
}
} }
</script> </script>
......
...@@ -387,7 +387,7 @@ export default { ...@@ -387,7 +387,7 @@ export default {
header: this.header, header: this.header,
success: res => { success: res => {
// 判断是否json字符串,将其转为json格式 // 判断是否json字符串,将其转为json格式
let data = this.toJson && this.checkIsJSON(res.data) ? JSON.parse(res.data) : res.data; let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
if (![200, 201].includes(res.statusCode)) { if (![200, 201].includes(res.statusCode)) {
this.uploadError(index, data); this.uploadError(index, data);
} else { } else {
...@@ -466,22 +466,6 @@ export default { ...@@ -466,22 +466,6 @@ export default {
}); });
} }
}); });
},
// 判断是否json字符串
checkIsJSON(str) {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
return false;
} }
} }
}; };
......
// 此版本发布于2020-07-17 // 此版本发布于2020-07-21
let version = '1.5.3'; let version = '1.5.4';
export default { export default {
v: version, v: version,
......
var array = require('./array.wxs');
var object = require('./object.wxs');
var PREFIX = 'van-';
function join(name, mods) {
name = PREFIX + name;
mods = mods.map(function(mod) {
return name + '--' + mod;
});
mods.unshift(name);
return mods.join(' ');
}
function traversing(mods, conf) {
if (!conf) {
return;
}
if (typeof conf === 'string' || typeof conf === 'number') {
mods.push(conf);
} else if (array.isArray(conf)) {
conf.forEach(function(item) {
traversing(mods, item);
});
} else if (typeof conf === 'object') {
object.keys(conf).forEach(function(key) {
conf[key] && mods.push(key);
});
}
}
function bem(name, conf) { function bem(name, conf) {
var mods = [];
traversing(mods, conf);
return join(name, mods);
} }
module.exports.bem = bem; module.exports.bem = bem;
...@@ -126,10 +126,18 @@ function rangeLength(value, param) { ...@@ -126,10 +126,18 @@ function rangeLength(value, param) {
return value.length >= param[0] && value.length <= param[1] return value.length >= param[0] && value.length <= param[1]
} }
/**
* 是否固定电话
*/
function landline(value) {
let reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
return reg.test(value);
}
/** /**
* 判断是否为空 * 判断是否为空
*/ */
function empty(value){ function empty(value) {
switch (typeof value) { switch (typeof value) {
case 'undefined': case 'undefined':
return true; return true;
...@@ -152,6 +160,45 @@ function empty(value){ ...@@ -152,6 +160,45 @@ function empty(value){
return false; return false;
} }
/**
* 是否json字符串
*/
function jsonString(value) {
if (typeof value == 'string') {
try {
var obj = JSON.parse(value);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
}
return false;
}
/**
* 是否数组
*/
function array(value) {
if (typeof Array.isArray === "function") {
return Array.isArray(value);
} else {
return Object.prototype.toString.call(value) === "[object Array]";
}
}
/**
* 是否对象
*/
function object(value) {
return Object.prototype.toString.call(value) === '[object Object]';
}
export default { export default {
email, email,
...@@ -171,5 +218,9 @@ export default { ...@@ -171,5 +218,9 @@ export default {
range, range,
rangeLength, rangeLength,
empty, empty,
isEmpty: empty isEmpty: empty,
jsonString,
landline,
object,
array
} }
...@@ -8,6 +8,8 @@ module.exports = { ...@@ -8,6 +8,8 @@ module.exports = {
}, },
methods: { methods: {
// 查询节点信息 // 查询节点信息
// 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
// 解决办法为在组件根部再套一个没有任何作用的view元素
$uGetRect(selector, all) { $uGetRect(selector, all) {
return new Promise(resolve => { return new Promise(resolve => {
uni.createSelectorQuery(). uni.createSelectorQuery().
......
{ {
"name": "uview-ui", "name": "uview-ui",
"version": "1.5.3", "version": "1.5.4",
"description": "uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水", "description": "uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
"main": "index.js", "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"],
......
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