Skip to content

Commit

Permalink
修复checkbox和radio在vue环境可能没有边框的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wlxuqu committed Oct 14, 2021
1 parent b1fe2fb commit e20d312
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Vue.mixin(mixin)
const app = new Vue({
store,
...App
})
})

// 引入请求封装
require('./util/request/index')(app)
Expand Down
1 change: 1 addition & 0 deletions uview-ui/components/u-checkbox/u-checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
font-size: $u-checkbox-icon-wrap-font-size;
border-width: $u-checkbox-icon-wrap-border-width;
border-color: $u-checkbox-icon-wrap-border-color;
border-style: solid;
/* #ifdef MP-TOUTIAO */
// 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
Expand Down
1 change: 1 addition & 0 deletions uview-ui/components/u-radio/u-radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
font-size: $u-radio-wrap-font-size;
border-width: $u-radio-wrap-border-width;
border-color: $u-radio-wrap-border-color;
border-style: solid;
/* #ifdef MP-TOUTIAO */
// 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
Expand Down
20 changes: 10 additions & 10 deletions uview-ui/libs/function/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getPx(value, unit = false) {
return unit ? `${value}px` : value;
}
// 如果带有rpx,先取出其数值部分,再转为px值
if (/rpx$/.test(value)) {
if (/(rpx|upx)$/.test(value)) {
return unit ? `${uni.upx2px(parseInt(value))}px` : uni.upx2px(parseInt(value));
} else {
return unit ? `${parseInt(value)}px` : parseInt(value);
Expand Down Expand Up @@ -390,7 +390,7 @@ function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
return _result.length ? prefix + _result.join('&') : '';
}

function toast(title, duration = 1500) {
function toast(title, duration = 2000) {
uni.showToast({
title: title,
icon: 'none',
Expand Down Expand Up @@ -436,23 +436,23 @@ function type2icon(type = 'success', fill = false) {
* 参数说明:
* number:要格式化的数字
* decimals:保留几位小数
* dec_point:小数点符号
* thousands_sep:千分位符号
* decimalPoint:小数点符号
* thousandsSeparator:千分位符号
* */
function priceFormat(number, decimals, dec_point, thousands_sep) {
function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
number = (number + '').replace(/[^0-9+-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number,
let n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator,
dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint,
s = '',
toFixedFix = function(n, prec) {
var k = Math.pow(10, prec);
let k = Math.pow(10, prec);
return '' + Math.ceil(n * k) / k;
};

s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
var re = /(-?\d+)(\d{3})/;
let re = /(-?\d+)(\d{3})/;
while (re.test(s[0])) {
s[0] = s[0].replace(re, '$1' + sep + '$2');
}
Expand Down

0 comments on commit e20d312

Please sign in to comment.