1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(x(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(b(5-M,2-B+e-11),b(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(l[T+2]=0,l[T+3]=0;T--;)P=l[T],l[T+3]|=255&P<<4,l[T+2]=P>>4;l[2]|=255&O<<4,l[1]=O>>4,l[0]=64|O>>12}else{for(l[T+1]=0,l[T+2]=0;T--;)P=l[T],l[T+2]|=255&P<<4,l[T+1]=P>>4;l[1]|=255&O<<4,l[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^d[w(f[m[L]]+T)]:m[L-1];m[0]=d[w(f[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=f[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,f=a.left,d=a.top;r.borderRadius,r.backgroundColor;var l=r.color,u=void 0===l?"#000000":l;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var b=0;b=s||n==c&&o=s)&&(a=e.width/i.width);var f=i.width*a,d=i.height*a,l=r||[],u=l[0],p=l[1],g=N(u)?Y(u,e.width):(e.width-f)*(U(u)?Y(u,1):{left:0,center:.5,right:1}[u||"center"]),v=N(p)?Y(p,e.height):(e.height-d)*(U(p)?Y(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},b=y(0,0),x=b[0],w=b[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(x,0),sy:I(w,0),sw:M(S-x,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(f,e.width),dh:M(d,e.height)}}({objectFit:u,objectPosition:v},e.contentSize,t),o=n.sx,s=n.sy,a=n.sh,h=n.sw,c=n.dx,f=n.dy,d=n.dh,l=n.dw;C==r.MP_BAIDU?i.drawImage(t.src,c+m,f+S,l,d,o,s,h,a):i.drawImage(t.src,o,s,h,a,c+m,f+S,l,d)}else i.drawImage(t.src,m,S,x,w)},k=function(){i.restore(),W.drawView(e,o,!1,!0,!1),h(1)},B=function(t){M(t),k()},B(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},t.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,f=a.width,d=a.height,l=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,b=i.fontFamily,x=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?Ct:I,k=i.backgroundColor,B=i.lineClamp,W=i.backgroundClip,P=i.textShadow,O=i.textDecoration;if(m=$(m)?m:0,this.drawView(e,i,W!=Ft),g=Y(g,v),t){o.save(),h+=l,c+=u;var T=n.fontHeight,L=n.descent,R=void 0===L?0:L,F=n.ascent,A=R+(void 0===F?0:F);switch(o.setFonts({fontFamily:b,fontSize:v,fontWeight:y,fontStyle:x}),o.setTextBaseline(Ct),o.setTextAlign(S),W?this.setBackground(k,f,d,h,c):o.setFillStyle(p),S){case Dt:break;case $t:h+=.5*f;break;case Yt:h+=f}var E=n.lines*g,j=Math.ceil((d-E)/2);switch(j<0&&(j=0),M){case jt:break;case Ct:c+=j;break;case Ht:c+=2*j}var C=(g-T)/2,H=g/2,D=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==jt?{fix:A?void 0===r?0:r:H-C/2,lineY:A?0:C-C/2}:M==Ct?{fix:A?H+n/4:H,lineY:A?0:C}:M==Ht?{fix:A?g-n:H+C/2,lineY:A?2*C:C+C/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case Dt:r+=i;break;case $t:r=(t-=i/2)+i;break;case Yt:r=t,t-=i}if(O){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(O)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(O)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(O)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:P}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:P}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:P}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var _=D(t),X=_.fix,q=void 0===X?0:X,G=_.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=B&&(Q+="…"),Z++,nt=0;var ct=D(Q);q=ct.fix,G=ct.lineY;N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==B&&K+ntV+d||Z>B)break}}o.restore()}},t.prototype.source=function(t){return i(this,void 0,void 0,(function(){var e,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(i in t.type=Et,t)["views","children","type","css","styles"].includes(i)||(t.styles[i]=t[i],delete t[i]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=n.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},t.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},t.prototype.create=function(t,r){return i(this,void 0,void 0,(function(){function i(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return t.forEach((function(t){var s=t.styles,a=void 0===s?{}:s,h=t.css,c=void 0===h?{}:h,f=t.children,d=void 0===f?[]:f,l=t.views,u=void 0===l?[]:l,p=t.text,g=void 0===p?"":p,v=t.type,y=void 0===v?"":v;!d&&u&&(t.children=d=u);var b={};b=e(e(r?e({},n):{},a),c);var x={},w={},m={};Object.keys(b).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=dt(t,b[t]);Object.keys(e).map((function(t){t.includes("Left")?w[t]=e[t]:t.includes("Right")?m[t]=e[t]:x[t]=e[t]}))}}));if(b.textIndent&&(w.textIndent=b.textIndent,delete n.textIndent),""!==g){var S=Array.from(g);S.forEach((function(t,e){var i=Object.assign({},b,x);0===e?Object.assign(i,w):e==S.length-1&&Object.assign(i,m),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(y==Rt||y==At)o.push(t);else if("block"===a.display&&d.length>0){var z=i(d,b,!1);t.children=z,t.flattened=!0,o.push(t)}else if(d.length>0){z=i(d,b,r);o=o.concat(z)}})),o}var o,s,a,h,c,f,d,l,u,p,g,v,y,b,x,w,m,S,z,I,M,k,B,P;return n(this,(function(n){switch(n.label){case 0:if(!t)return[2];if(t.styles||(t.styles=t.css||{}),o=t.type,s=t.show,a=void 0===s||s,h=o==Rt,c=[Ft,At].includes(o),f="textBox"==o,d=t.styles||{},l=d.backgroundImage,u=d.display,h&&!t.src&&!t.url)return[2];if(u==W||!a)return[2];if(c||f){if(p=t.children,g=t.views,!p&&g&&(t.children=p=g),!t.text&&(!p||p&&!p.length))return[2];p&&p.length&&!t.flattened&&(v=i(t.children||t.views),t.type="view",t.children=v)}if(!(h||t.type==Et&&l))return[3,4];y=h?t.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(l),l&&b&&b[1]&&(y=b[1]||""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.getImageInfo(y)];case 2:return x=n.sent(),w=x.width,m=x.height,!(S=x.path)&&h?[2]:(S&&(t.attributes=Object.assign(t.attributes||{},{width:w,height:m,path:S,src:S,naturalSrc:y})),[3,4]);case 3:return z=n.sent(),t.type!=Et?[2]:(this.lifecycle("onEffectFail",e(e({},z),{src:y})),[3,4]);case 4:if(this.count+=1,I=new Tt(t,r,this.root,this.ctx),!(M=t.children||t.views))return[3,8];k=0,n.label=5;case 5:return k uniapp 海报画板,更优雅的海报生成方案
-> [查看更多 站点 1](https://limeui.qcoon.cn/#/painter)
-> [查看更多 站点 2](http://liangei.gitee.io/limeui/#/painter)
-> Q 群:1169785031
+> [查看更多](https://limeui.qcoon.cn/#/painter)
## 平台兼容
diff --git a/uni_modules/lime-style/changelog.md b/uni_modules/lime-style/changelog.md
new file mode 100644
index 0000000..c12d39b
--- /dev/null
+++ b/uni_modules/lime-style/changelog.md
@@ -0,0 +1,48 @@
+## 0.2.4(2025-11-14)
+- feat: 优化create-var
+## 0.2.3(2025-10-19)
+- fix: 修复非uts环境使用set的问题
+## 0.2.2(2025-10-15)
+- fix: 去掉版本判断
+## 0.2.1(2025-10-15)
+- fix: 修复条件判断问题
+## 0.2.0(2025-10-01)
+- fix: 修复uniapp主题变化报错问题
+## 0.1.9(2025-09-26)
+- feat: 更新宫格暗黑hover颜色
+## 0.1.8(2025-09-08)
+- feat: 去掉vue2的判断
+## 0.1.7(2025-08-15)
+更新变量
+## 0.1.6(2025-06-20)
+- feat: 放弃使用rpx
+## 0.1.5(2025-06-20)
+- fix: 修复 vue2 rpx转成px的问题
+## 0.1.4(2025-06-12)
+- feat: 增加一些函数
+## 0.1.3(2025-05-07)
+- feat: 增加`hairline`函数
+## 0.1.2(2025-04-24)
+- feat: 根据官方建议,字体使用px
+## 0.1.1(2025-03-25)
+- feat: 更换rbgToHsv算法
+## 0.1.0(2025-03-13)
+- feat: hbx4.56 Vue2 scss 预编译器默认已由 node-sass 更换为 dart-sass
+## 0.0.9(2025-01-16)
+- feat: 更新
+## 0.0.8(2024-12-15)
+- fix: 修复vue2 不支持rgba(0,0,0,1%)
+## 0.0.7(2024-12-11)
+- feat: 增加除法
+## 0.0.6(2024-12-04)
+- fix: 除法问题
+## 0.0.5(2024-11-20)
+- feat: 增加flex
+## 0.0.4(2024-11-20)
+- feat: 增加flex
+## 0.0.3(2024-09-30)
+- fix: 由于 vue2 h5 css变量不支持rpx,故转成px
+## 0.0.2(2024-09-23)
+- fix: 修复 vue2 math.div 问题
+## 0.0.1(2024-09-02)
+- init
diff --git a/uni_modules/lime-style/color/colorPalette.scss b/uni_modules/lime-style/color/colorPalette.scss
new file mode 100644
index 0000000..6408e72
--- /dev/null
+++ b/uni_modules/lime-style/color/colorPalette.scss
@@ -0,0 +1,236 @@
+/* #ifdef VUE3 */
+@use "sass:math";
+/* #endif */
+
+
+
+$hueStep: 2;
+$saturationStep1: 0.16;
+$saturationStep2: 0.05;
+$brightnessStep1: 0.05;
+$brightnessStep2: 0.15;
+$lightColorCount: 5;
+$darkColorCount: 4;
+
+$darkColorMap: (
+ (index: 7, opacity: 0.15),
+ (index: 6, opacity: 0.25),
+ (index: 5, opacity: 0.3),
+ (index: 5, opacity: 0.45),
+ (index: 5, opacity: 0.65),
+ (index: 5, opacity: 0.85),
+ (index: 4, opacity: 0.9),
+ (index: 3, opacity: 0.95),
+ (index: 2, opacity: 0.97),
+ (index: 1, opacity: 0.98)
+);
+
+@function div($dividend, $divisor) {
+ /* #ifdef VUE3 */
+ @return math.div($dividend, $divisor);
+ /* #endif
+ /* #ifndef VUE3 */
+ @return $dividend / $divisor;
+ /* #endif */
+}
+
+// 求一个数的n次幂
+@function pow($number, $n) {
+ $ret: 1;
+ @if $n >= 0 {
+ @for $i from 1 through $n {
+ $ret: $ret * $number;
+ }
+ } @else {
+ @for $i from $n to 0 {
+ $ret: $ret / $number;
+ }
+ }
+ @return $ret;
+}
+
+// 浮点数保留小数位
+@function toFixed($float, $digits: 2) {
+ $pow: pow(10, $digits);
+ @return div(round($float * $pow) , $pow);
+}
+
+
+// 根据颜色获取对应的hsv,在tinycolor中首先进行了归一化处理,这里没有
+// 返回的结果h是0~360,代表的是色相的角度, sv的范围0-1
+@function rbgToHsv($limeColor) {
+ $r: red($limeColor);
+ $g: green($limeColor);
+ $b: blue($limeColor);
+ $max: max($r, $g, $b);
+ $min: min($r, $g, $b);
+ $diff: $max - $min;
+ $h: 0;
+
+ @if $max == $min {
+ $h: 0
+ } @else if $max == $r {
+ $h: div(60 * ($g - $b) , $diff) + if($g >= $b, 0, 360);
+ } @else if $max == $g {
+ $h: 60 * div($b - $r , $diff) + 120 //($b - $r) / $diff + 120;
+ } @else if $max == $b{
+ $h: div(60 * ($r - $g) , $diff) + 240;
+ }
+
+ $s: if($max == 0, 0, div($diff , $max));
+ $v: div($max , 255);
+
+ @return $h, $s, $v;
+}
+// hsv转化成rgb,借鉴了tinycolor的做法,避免通过$th的值判断来获取对应的rgb的取值
+// $t1~4的计算目前不清楚为什么这样做
+@function hsvTorgb($h, $s, $v) {
+ // $th: floor(div($h , 60));
+ // $t1: div($h , 60) - $th;
+ // $t2: $v * (1 - $s);
+ // $t3: $v * (1 - $t1 * $s);
+ // $t4: $v * (1 - (1 - $t1) * $s);
+ // $i: $th + 1;
+ // $r: nth(($v, $t3, $t2, $t2, $t4, $v), $i);
+ // $g: nth(($t4, $v, $v, $t3, $t2, $t2), $i);
+ // $b: nth(($t2, $t2, $t4, $v, $v, $t3), $i);
+
+ // @return rgb($r * 255, $g * 255, $b * 255);
+ $h: $h % 360;
+
+ // 2. 计算色相区域 (0~5),对应6个60度区间
+ $th: floor(div($h, 60)) % 6; // 强制th在0~5之间
+
+ // 3. 计算中间变量
+ $t1: div($h, 60) - $th;
+ $t2: $v * (1 - $s);
+ $t3: $v * (1 - $t1 * $s);
+ $t4: $v * (1 - (1 - $t1) * $s);
+
+ // 4. 根据色相区域选择RGB分量
+ $i: $th + 1; // 索引范围锁定为1~6
+
+ // 定义各区域对应的RGB系数
+ $r-values: ($v, $t3, $t2, $t2, $t4, $v);
+ $g-values: ($t4, $v, $v, $t3, $t2, $t2);
+ $b-values: ($t2, $t2, $t4, $v, $v, $t3);
+
+ // 5. 获取RGB分量并转换为0~255整数
+ $r: nth($r-values, $i) * 255;
+ $g: nth($g-values, $i) * 255;
+ $b: nth($b-values, $i) * 255;
+
+ // 6. 返回RGB颜色值
+ @return rgb(round($r), round($g), round($b));
+}
+
+//转换色相
+@function getHue($h, $i, $isLight) {
+ $hue: null;
+ @if $h >= 60 and $h <= 240 {
+ $hue: if($isLight, $h - $hueStep * $i, $h + $hueStep * $i);
+ } @else {
+ $hue: if($isLight, $h + $hueStep * $i, $h - $hueStep * $i);
+ }
+
+ $hue: ($hue + 360) % 360;
+
+ @return round($hue);
+}
+
+// 转换饱和度
+@function getSaturation($s, $i, $isLight) {
+ $saturation: null;
+ @if $isLight {
+ $saturation: $s - $saturationStep1 * $i;
+ } @else if $i == $darkColorCount {
+ $saturation: $s + $saturationStep1;
+ } @else {
+ $saturation: $s + $saturationStep2 * $i;
+ }
+ $saturation: min($saturation, 1);
+
+ @if $isLight and $i == $lightColorCount and $saturation > 0.1 {
+ $saturation: 0.1;
+ }
+
+ $saturation: max($saturation, 0.06);
+
+ @return toFixed($saturation, 2);
+}
+
+// 转换明度
+@function getValue($v, $i, $isLight) {
+ $value: min(
+ if(
+ $isLight,
+ $v + $brightnessStep1 * $i,
+ $v - $brightnessStep2 * $i
+ ),
+ 1);
+
+ @return toFixed($value, 2);
+}
+
+
+@function mix($rgb1, $rgb2, $amount){
+ $p: $amount;
+ $r: (red($rgb2) - red($rgb1)) * $p + red($rgb1);
+ $g: (green($rgb2) - green($rgb1)) * $p + green($rgb1);
+ $b: (blue($rgb2) - blue($rgb1)) * $p + blue($rgb1);
+
+ @return rgb($r, $g, $b)
+}
+
+// 根据颜色和对应的色板位置,计算出对应的色板颜色
+@function genColor($color, $index, $theme: 'default' , $bgColor: #242424) {
+ $isLight: if($index <= 6, true, false);
+ $hsv: rbgToHsv($color);
+ //这里将i转换成以主色为中心,两侧的i值逐渐增大
+ $i: if($isLight, $lightColorCount + 1 - $index, $index - $lightColorCount - 1);
+
+ @if $theme == 'dark' {
+ $item: nth($darkColorMap, $index);
+ $index2: map-get($item, index);
+ $opacity: map-get($item, opacity);
+
+ $rgb: genColor($color, $index2 + 1);
+
+ // @return $rgb;
+ @return mix(
+ $bgColor,
+ $rgb,
+ $opacity
+ )
+ }
+
+ @return hsvTorgb(
+ getHue(nth($hsv, 1), $i, $isLight),
+ getSaturation(nth($hsv, 2), $i, $isLight),
+ getValue(nth($hsv, 3), $i, $isLight)
+ );
+}
+
+@function getSolidColor($base-color, $brightness) {
+ // 验证输入参数
+ @if type-of($base-color) != 'color' {
+ @error "Expected color for $base-color, but got #{type-of($base-color)}: #{$base-color}";
+ }
+
+ @if type-of($brightness) != 'number' {
+ @error "Expected number for $brightness, but got #{type-of($brightness)}: #{$brightness}";
+ }
+
+ // 获取基础颜色的HSL值
+ $hue: hue($base-color);
+ $saturation: saturation($base-color);
+ $lightness: lightness($base-color);
+
+ // 计算新的亮度值 (限制在0-100%范围内)
+ $new-lightness: clamp(0%, $lightness + $brightness, 100%);
+
+ // 使用HSL函数创建新颜色
+ $new-color: hsl($hue, $saturation, $new-lightness);
+
+ @return $new-color;
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/color/colors.scss b/uni_modules/lime-style/color/colors.scss
new file mode 100644
index 0000000..2f1a1d5
--- /dev/null
+++ b/uni_modules/lime-style/color/colors.scss
@@ -0,0 +1,18 @@
+// 品牌色-主色
+$primary-color: #3283ff!default;
+// 错误色
+$error-color: #FF4D4F!default;
+// 警告色
+$warning-color: #ffb400!default;// #FF7D00!default;
+// 信息色
+$info-color: $primary-color!default;
+// 成功色
+$success-color: #34c471!default;
+
+$blue: #3283ff!default;
+$red: #FF4D4F!default;
+$orange: #ffb400!default;
+$yellow: #fcd53f!default;
+$green: #34c471 !default;
+$white: #fff;
+$black: #000;
diff --git a/uni_modules/lime-style/functions.scss b/uni_modules/lime-style/functions.scss
new file mode 100644
index 0000000..8332c1a
--- /dev/null
+++ b/uni_modules/lime-style/functions.scss
@@ -0,0 +1,11 @@
+/* #ifdef VUE3 */
+@use "sass:math";
+// #endif
+@function divide($dividend, $divisor) {
+ /* #ifdef VUE3 */
+ @return math.div($dividend, $divisor);
+ /* #endif
+ /* #ifndef VUE3 */
+ @return $dividend / $divisor;
+ /* #endif
+}
diff --git a/uni_modules/lime-style/hairline.uts b/uni_modules/lime-style/hairline.uts
new file mode 100644
index 0000000..8dc0d89
--- /dev/null
+++ b/uni_modules/lime-style/hairline.uts
@@ -0,0 +1,153 @@
+import { unitConvert } from '@/uni_modules/lime-shared/unitConvert';
+
+export type DrawBorderOptions = {
+ direction : 'top' | 'bottom' | 'left' | 'right';
+ color ?: string;
+ colorKey ?: string; // 在dom中获取颜色
+ startOffsetKey?: string; // 在dom哪个属性获取
+ startOffset ?: number | string; // 支持数字或 CSS 字符串(如 '10px')
+ endOffset ?: number | string;
+ lineWidth ?: number;
+ watchSize ?: boolean; // 是否监听尺寸变化自动重绘
+ immediate ?: boolean; // 是否立即绘制
+ bordered?: boolean;
+
+}
+
+export type UseDrawBorderReturn = {
+ color: Ref,
+ renderBorder: () => void,
+ clearBorder: () => void;
+ dispose: () => void,
+}
+/**
+ * 在元素上绘制边框,并支持动态监听尺寸变化
+ * @param elementRef 目标元素的 Ref
+ * @param options 边框配置
+ * @returns 清理函数(用于卸载时取消监听)
+ */
+export function useDrawBorder(
+ elementRef : Ref,
+ options : DrawBorderOptions
+):UseDrawBorderReturn {
+ let resizeObserver : UniResizeObserver | null = null;
+ const { watchSize = true, immediate = true } = options;
+ const defalutColor = '#e7e7e7'
+ const color = ref(options.color ?? defalutColor)
+ const bordered = ref(options.bordered ?? true)
+ let computedStartOffset = 0
+ let computedEndOffset = 0
+
+ // 绘制边框
+ const renderBorder = () => {
+ if (elementRef.value == null) return;
+ const ctx = elementRef.value!.getDrawableContext();
+ if (ctx == null) return;
+
+ const rect = elementRef.value!.getBoundingClientRect();
+ ctx.reset();
+
+ const {
+ direction,
+ startOffset = 0,
+ endOffset = 0,
+ lineWidth = 0.5,
+ colorKey,
+ startOffsetKey,
+ } = options;
+
+
+ // 转换单位(如果是字符串,如 '10px')
+ if(computedStartOffset == 0) {
+ computedStartOffset = unitConvert((startOffsetKey != null ? elementRef.value?.style.getPropertyValue(startOffsetKey!) ?? startOffset : startOffset))
+ }
+ if(computedEndOffset == 0) {
+ computedEndOffset = unitConvert(endOffset)
+ }
+
+ if(color.value == defalutColor && colorKey != null) {
+ color.value = elementRef.value?.style.getPropertyValue(colorKey!) ?? defalutColor
+ // if(color.value.length == 0) {
+ // color.value = defalutColor
+ // }
+ }
+ ctx.strokeStyle = color.value;
+ ctx.lineWidth = lineWidth;
+
+ // 根据方向计算坐标
+ switch (direction) {
+ case 'top':
+ ctx.moveTo(computedStartOffset, 0);
+ ctx.lineTo(rect.width - computedEndOffset, 0);
+ break;
+ case 'bottom':
+ ctx.moveTo(computedStartOffset, rect.height - 0.25);
+ ctx.lineTo(rect.width - computedEndOffset, rect.height - 0.25);
+ break;
+ case 'left':
+ ctx.moveTo(0, computedStartOffset);
+ ctx.lineTo(0, rect.height - computedEndOffset);
+ break;
+ case 'right':
+ ctx.moveTo(rect.width, computedStartOffset);
+ ctx.lineTo(rect.width, rect.height - computedEndOffset);
+ break;
+ }
+
+ ctx.stroke();
+ ctx.update();
+ };
+
+ const setupResizeObserver = () => {
+ // 监听尺寸变化(如果启用)
+ if (watchSize) {
+ if (resizeObserver == null) {
+ resizeObserver = new UniResizeObserver((entries : Array) => {
+ if(!bordered.value) return
+ renderBorder();
+ })
+ }
+ watchEffect(()=>{
+ if (elementRef.value != null) {
+ resizeObserver!.observe(elementRef.value!);
+ }
+ })
+ }
+ }
+
+
+ // 清理函数(卸载时取消监听)
+ const dispose = () => {
+ if (resizeObserver != null && elementRef.value != null) {
+ // resizeObserver.unobserve(elementRef.value!);
+ resizeObserver!.disconnect();
+ resizeObserver = null;
+ }
+ };
+
+ const clearBorder = ()=> {
+ if (elementRef.value == null) return;
+ const ctx = elementRef.value!.getDrawableContext();
+ if (ctx == null) return;
+ bordered.value = false
+ ctx.reset()
+ ctx.update()
+ }
+
+ setupResizeObserver()
+ // 初始绘制
+ if(immediate) {
+ renderBorder();
+ }
+
+
+
+
+ return {
+ renderBorder, // 手动触发绘制
+ dispose, // 清理监听
+ clearBorder,
+ color
+ } as UseDrawBorderReturn
+
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/index.scss b/uni_modules/lime-style/index.scss
new file mode 100644
index 0000000..edd46a7
--- /dev/null
+++ b/uni_modules/lime-style/index.scss
@@ -0,0 +1,7 @@
+@import './theme/default';
+@import './var';
+// @import './mixins/ellipsis';
+// @import './mixins/hairline';
+@import './mixins/create';
+@import './mixins/directionalProperty';
+// @import './mixins/useTheme';
\ No newline at end of file
diff --git a/uni_modules/lime-style/index.uts b/uni_modules/lime-style/index.uts
new file mode 100644
index 0000000..208438f
--- /dev/null
+++ b/uni_modules/lime-style/index.uts
@@ -0,0 +1,3 @@
+export * from './token/useThemeMode'
+export * from './token/useThemeVars'
+export * from './token/interface'
\ No newline at end of file
diff --git a/uni_modules/lime-style/mixins/bem.scss b/uni_modules/lime-style/mixins/bem.scss
new file mode 100644
index 0000000..e69de29
diff --git a/uni_modules/lime-style/mixins/create.scss b/uni_modules/lime-style/mixins/create.scss
new file mode 100644
index 0000000..ea313a9
--- /dev/null
+++ b/uni_modules/lime-style/mixins/create.scss
@@ -0,0 +1,235 @@
+/* #ifdef VUE3 */
+@use "sass:math";
+/* #endif */
+
+/* #ifndef UNI-APP-X && APP || APP-NVUE */
+$use-css-var: true !default;
+/* #endif */
+/* #ifdef UNI-APP-X && APP || APP-NVUE */
+$use-css-var: false !default;
+/* #endif */
+
+
+@function div($dividend, $divisor) {
+ /* #ifdef VUE3 */
+ @return math.div($dividend, $divisor);
+ /* #endif */
+ /* #ifndef VUE3 */
+ @return $dividend / $divisor;
+ /* #endif */
+}
+
+@function rpx-to-px($value) {
+ // 递归处理列表
+ @if type-of($value) == list {
+ $new-list: ();
+ @each $item in $value {
+ $new-list: append($new-list, rpx-to-px($item));
+ }
+ @return $new-list;
+ }
+
+ // 处理数字类型 - 带 rpx 单位
+ @if type-of($value) == number and unit($value) == 'rpx' {
+ // 安全处理单位转换
+ @return calc-strip-unit($value) * 0.5 * 1px;
+ }
+
+ // 处理字符串类型
+ @if type-of($value) == string {
+ $string: $value;
+ $rpx-index: str-index($string, 'rpx');
+
+ // 如果字符串以数字开头并以 rpx 结尾,转换为数值
+ @if $rpx-index == (str-length($string) - 2) {
+ $num-str: str-slice($string, 1, $rpx-index - 1);
+ $number: to-number($num-str);
+ @if type-of($number) == number {
+ @return $number * 0.5 * 1px;
+ }
+ }
+
+ // 字符串中可能包含多个 rpx 值
+ @if $rpx-index {
+ $result: '';
+ @while $rpx-index {
+ // 找到数字部分起点
+ $num-end: $rpx-index - 1;
+ $num-start: $num-end;
+ @while $num-start > 0 and is-numeric-char(str-slice($string, $num-start, $num-start)) {
+ $num-start: $num-start - 1;
+ }
+
+ // 提取数字部分
+ $num-str: str-slice($string, $num-start + 1, $num-end);
+ $number: to-number($num-str);
+
+ // 转换为 px 数值
+ $px-value: $number * 0.5 * 1px;
+
+ // 构建结果字符串
+ $result: $result + str-slice($string, 1, $num_start) + '#{$px_value}';
+
+ // 更新剩余字符串
+ $string: str-slice($string, $rpx-index + 3);
+ $rpx-index: str-index($string, 'rpx');
+ }
+ @return #{$result + $string};
+ }
+ }
+
+ // 其他类型直接返回
+ @return $value;
+}
+
+// 辅助函数:安全去除单位并返回数值
+@function calc-strip-unit($number) {
+ @if type-of($number) == number {
+ $unit: unit($number);
+ $units: ("px": 1px, "rpx": 1rpx, "em": 1em, "rem": 1rem, "%": 1%);
+
+ @if map-has-key($units, $unit) {
+ @return div($number , map-get($units, $unit));
+ }
+
+ @if unitless($number) {
+ @return $number;
+ }
+ }
+
+ @return $number;
+}
+
+// 辅助函数:检查字符是否为数字
+@function is-numeric-char($char) {
+ $chars: "-.0123456789";
+ @return str-index($chars, $char) != null;
+}
+
+// 辅助函数:将字符串安全转换为数字
+@function to-number($string) {
+ // 如果输入已经是数字,直接返回
+ @if type-of($string) == number {
+ @return $string;
+ }
+
+ // 处理带符号的数字
+ $is-negative: false;
+ $numeric: "";
+ $found-number: false;
+
+ // 提取所有数字字符
+ @for $i from 1 through str-length($string) {
+ $char: str-slice($string, $i, $i);
+
+ @if $char == "-" and $numeric == "" {
+ $is-negative: true;
+ }
+ @else if $char == "." and str-index($numeric, ".") == null {
+ $numeric: $numeric + $char;
+ }
+ @else if $char >= "0" and $char <= "9" {
+ $numeric: $numeric + $char;
+ $found-number: true;
+ }
+ }
+
+ // 如果有实际数字内容,转换为数值
+ @if $found-number {
+ $result: 0;
+ $decimal-index: str-index($numeric, ".");
+
+ @if $decimal-index {
+ // 处理带小数的数字
+ $integer-part: str-slice($numeric, 1, $decimal-index - 1);
+ $decimal-part: str-slice($numeric, $decimal-index + 1);
+
+ @if $integer-part == "" { $integer-part: "0"; }
+
+ $result: to-integer($integer-part);
+
+ $divisor: 1;
+ @for $i from 1 through str-length($decimal-part) {
+ $divisor: $divisor * 10;
+ $digit: to-integer(str-slice($decimal-part, $i, $i));
+ $result: $result + ($digit / $divisor);
+ }
+ } @else {
+ // 处理整数
+ $result: to-integer($numeric);
+ }
+
+ @return if($is-negative, -$result, $result);
+ }
+
+ // 无法转换则返回原字符串
+ @return $string;
+}
+
+// 辅助函数:将整数字符串转换为数字
+@function to-integer($string) {
+ $result: 0;
+
+ @for $i from 1 through str-length($string) {
+ $char: str-slice($string, $i, $i);
+ $result: $result * 10 + (str-index("0123456789", $char) - 1);
+ }
+
+ @return $result;
+}
+
+@function create-var($name, $values...) {
+ // 将不定数量的参数转换为列表
+ $value-list: $values;
+ $css-value: null;
+
+ @if length($value-list) == 0 {
+ // @warn "The list must have at least 1 values.";
+ @return '';
+ } @else {
+ // 初始化CSS变量的值为列表中的第一个值
+ /* #ifndef VUE2 */
+ $css-value: nth($value-list, 1);
+ /* #endif */
+ /* #ifdef VUE2 */
+ $css-value: rpx-to-px(nth($value-list, 1));
+ /* #endif */
+ }
+ // 检查列表长度是否大于等于2
+ @if length($value-list) >= 2 {
+ // 使用@for循环遍历剩余的值,并构建CSS变量的完整值
+ @for $i from 2 through length($value-list) {
+ /* #ifndef VUE2 */
+ $css-value: $css-value + ", " + nth($value-list, $i);
+ /* #endif */
+ /* #ifdef VUE2 */
+ $css-value: $css-value + ", " + rpx-to-px(nth($value-list, $i));
+ /* #endif */
+ }
+ }
+
+ // /* #ifndef UNI-APP-X */
+ // @return var(--l-#{$name}, #{$css-value});
+ // /* #endif */
+
+ // /* #ifdef UNI-APP-X && APP */
+ // @if $use-css-var {
+ // @return var(--l-#{$name}, #{$css-value});
+ // } @else {
+ // @return $css-value;
+ // }
+ // /* #endif */
+
+
+ // /* #ifdef APP-NVUE */
+ // @return $css-value;
+ // /* #endif */
+
+ // @return var(--l-#{$name}, #{$css-value});
+
+ @if $use-css-var {
+ @return var(--l-#{$name}, #{$css-value});
+ } @else {
+ @return $css-value;
+ }
+}
diff --git a/uni_modules/lime-style/mixins/directionalProperty.scss b/uni_modules/lime-style/mixins/directionalProperty.scss
new file mode 100644
index 0000000..6d23d1a
--- /dev/null
+++ b/uni_modules/lime-style/mixins/directionalProperty.scss
@@ -0,0 +1,401 @@
+// =======================================================================
+// 方向属性核心生成器 (支持所有方向相关属性)
+// =======================================================================
+@mixin directional-property(
+ $property,
+ $values,
+ $exclude: ()
+) {
+ // 属性类型分组
+ $group-standard: padding, margin; // 标准方向属性
+ $group-radius: border-radius; // 圆角属性
+ $group-border: border, border-top, border-right, border-bottom, border-left; // 边框属性
+ $group-outline: outline, outline-top, outline-right, outline-bottom, outline-left; // 轮廓属性
+ $group-position: inset, inset-block, inset-inline, top, right, bottom, left; // 定位属性
+ $group-size: block-size, inline-size; // 块/行尺寸属性
+
+ // 定义每个方向的值
+ $top: null;
+ $right: null;
+ $bottom: null;
+ $left: null;
+
+ // 确定处理模式
+ $is-standard: index($group-standard, $property);
+ $is-radius: index($group-radius, $property);
+ $is-border: index($group-border, $property);
+ $is-outline: index($group-outline, $property);
+ $is-position: index($group-position, $property);
+ $is-size: index($group-size, $property);
+
+ // =====================================================================
+ // 解析输入值 - 根据属性类型处理
+ // =====================================================================
+ @if type-of($values) == 'list' {
+ $length: length($values);
+
+ // 单个值 - 所有方向相同值
+ @if $length == 1 {
+ $top: nth($values, 1);
+ $right: nth($values, 1);
+ $bottom: nth($values, 1);
+ $left: nth($values, 1);
+ }
+
+ // 两个值
+ @else if $length == 2 {
+ // 特殊处理:border-radius
+ @if $is-radius {
+ $top: nth($values, 1);
+ $right: nth($values, 2);
+ $bottom: nth($values, 1);
+ $left: nth($values, 2);
+ }
+ // 标准处理:上下 | 左右
+ @else if $is-standard or $is-border or $is-outline or $is-position {
+ $top: nth($values, 1);
+ $bottom: nth($values, 1);
+ $right: nth($values, 2);
+ $left: nth($values, 2);
+ }
+ // 块/行尺寸处理
+ @else if $is-size {
+ $top: nth($values, 1);
+ $right: nth($values, 2);
+ }
+ }
+
+ // 三个值
+ @else if $length == 3 {
+ // border-radius特殊处理
+ @if $is-radius {
+ $top: nth($values, 1);
+ $right: nth($values, 2);
+ $bottom: nth($values, 3);
+ $left: nth($values, 2);
+ }
+ // 标准处理
+ @else if $is-standard or $is-border or $is-outline or $is-position {
+ $top: nth($values, 1);
+ $right: nth($values, 2);
+ $left: nth($values, 2);
+ $bottom: nth($values, 3);
+ }
+ }
+
+ // 四个值
+ @else if $length == 4 {
+ $top: nth($values, 1);
+ $right: nth($values, 2);
+ $bottom: nth($values, 3);
+ $left: nth($values, 4);
+ }
+ }
+ @else {
+ // 单个值传递
+ $top: $values;
+ $right: $values;
+ $bottom: $values;
+ $left: $values;
+ }
+
+ // =====================================================================
+ // 生成CSS属性(排除指定方向)
+ // =====================================================================
+
+ // 1. 圆角处理
+ @if $is-radius {
+ @if not index($exclude, top-left) and $top != null {
+ border-top-left-radius: $top;
+ }
+ @if not index($exclude, top-right) and $right != null {
+ border-top-right-radius: $right;
+ }
+ @if not index($exclude, bottom-right) and $bottom != null {
+ border-bottom-right-radius: $bottom;
+ }
+ @if not index($exclude, bottom-left) and $left != null {
+ border-bottom-left-radius: $left;
+ }
+ }
+
+ // 2. 标准方向处理 (padding, margin)
+ @else if $is-standard {
+ @if not index($exclude, top) and $top != null {
+ #{$property}-top: $top;
+ }
+ @if not index($exclude, right) and $right != null {
+ #{$property}-right: $right;
+ }
+ @if not index($exclude, bottom) and $bottom != null {
+ #{$property}-bottom: $bottom;
+ }
+ @if not index($exclude, left) and $left != null {
+ #{$property}-left: $left;
+ }
+ }
+
+ // 3. 边框处理
+ @else if $is-border {
+ // 完整边框设置
+ @if $property == 'border' {
+ @if not index($exclude, top) and $top != null {
+ border-top-width: nth($values, 1);
+ border-top-style: nth($values, 2);
+ border-top-color: nth($values, 3);
+ }
+ @if not index($exclude, right) and $right != null {
+ border-right-width: nth($values, 1);
+ border-right-style: nth($values, 2);
+ border-right-color: nth($values, 3);
+ }
+ @if not index($exclude, bottom) and $bottom != null {
+ // border-bottom: $bottom;
+ border-bottom-width: nth($values, 1);
+ border-bottom-style: nth($values, 2);
+ border-bottom-color: nth($values, 3);
+ }
+ @if not index($exclude, left) and $left != null {
+ // border-left: $left;
+ border-left-width: nth($values, 1);
+ border-left-style: nth($values, 2);
+ border-left-color: nth($values, 3);
+ }
+ }
+ // 单边边框
+ @else {
+ $direction: str-slice($property, 8); // 提取方向
+ @if not index($exclude, $direction) {
+ // #{$property}: $top;
+ #{$property}-width: nth($values, 1);
+ #{$property}-style: nth($values, 2);
+ #{$property}-color: nth($values, 3);
+ }
+ }
+ }
+
+ // 4. 轮廓处理
+ @else if $is-outline {
+ // 完整轮廓设置
+ @if $property == 'outline' {
+ @if not index($exclude, top) and $top != null {
+ outline-top: $top;
+ }
+ @if not index($exclude, right) and $right != null {
+ outline-right: $right;
+ }
+ @if not index($exclude, bottom) and $bottom != null {
+ outline-bottom: $bottom;
+ }
+ @if not index($exclude, left) and $left != null {
+ outline-left: $left;
+ }
+ }
+ // 单边轮廓
+ @else {
+ $direction: str-slice($property, 8); // 提取方向
+ @if not index($exclude, $direction) {
+ #{$property}: $top;
+ }
+ }
+ }
+
+ // 5. 定位处理
+ @else if $is-position {
+ // inset简写处理
+ @if $property == 'inset' {
+ @if not index($exclude, top) and $top != null {
+ top: $top;
+ }
+ @if not index($exclude, right) and $right != null {
+ right: $right;
+ }
+ @if not index($exclude, bottom) and $bottom != null {
+ bottom: $bottom;
+ }
+ @if not index($exclude, left) and $left != null {
+ left: $left;
+ }
+ }
+ // inset-block 和 inset-inline
+ @else if $property == 'inset-block' {
+ @if not index($exclude, top) and $top != null {
+ top: $top;
+ }
+ @if not index($exclude, bottom) and $bottom != null {
+ bottom: $bottom;
+ }
+ }
+ @else if $property == 'inset-inline' {
+ @if not index($exclude, left) and $left != null {
+ left: $left;
+ }
+ @if not index($exclude, right) and $right != null {
+ right: $right;
+ }
+ }
+ // 单一定位
+ @else {
+ @if not index($exclude, $property) {
+ #{$property}: $top;
+ }
+ }
+ }
+
+ // 6. 尺寸处理
+ @else if $is-size {
+ @if $property == 'block-size' {
+ @if not index($exclude, top) and $top != null {
+ height: $top;
+ }
+ }
+ @else if $property == 'inline-size' {
+ @if not index($exclude, left) and $left != null {
+ width: $left;
+ }
+ }
+ }
+}
+
+// =======================================================================
+// 快捷混合宏:标准属性
+// =======================================================================
+@mixin padding($values, $exclude: ()) {
+ @include directional-property(padding, $values, $exclude);
+}
+
+@mixin margin($values, $exclude: ()) {
+ @include directional-property(margin, $values, $exclude);
+}
+
+@mixin border-radius($values, $exclude: ()) {
+ @include directional-property(border-radius, $values, $exclude);
+}
+
+// =======================================================================
+// 快捷混合宏:边框属性
+// =======================================================================
+@mixin border($value, $exclude: ()) {
+ @include directional-property(border, $value, $exclude);
+}
+
+@mixin border-top($value, $exclude: ()) {
+ @include directional-property(border-top, $value, $exclude);
+}
+
+@mixin border-right($value, $exclude: ()) {
+ @include directional-property(border-right, $value, $exclude);
+}
+
+@mixin border-bottom($value, $exclude: ()) {
+ @include directional-property(border-bottom, $value, $exclude);
+}
+
+@mixin border-left($value, $exclude: ()) {
+ @include directional-property(border-left, $value, $exclude);
+}
+
+// =======================================================================
+// 快捷混合宏:轮廓属性
+// =======================================================================
+@mixin outline($value, $exclude: ()) {
+ @include directional-property(outline, $value, $exclude);
+}
+
+@mixin outline-top($value, $exclude: ()) {
+ @include directional-property(outline-top, $value, $exclude);
+}
+
+@mixin outline-right($value, $exclude: ()) {
+ @include directional-property(outline-right, $value, $exclude);
+}
+
+@mixin outline-bottom($value, $exclude: ()) {
+ @include directional-property(outline-bottom, $value, $exclude);
+}
+
+@mixin outline-left($value, $exclude: ()) {
+ @include directional-property(outline-left, $value, $exclude);
+}
+
+// =======================================================================
+// 快捷混合宏:定位属性
+// =======================================================================
+@mixin inset($values, $exclude: ()) {
+ @include directional-property(inset, $values, $exclude);
+}
+
+@mixin inset-block($values, $exclude: ()) {
+ @include directional-property(inset-block, $values, $exclude);
+}
+
+@mixin inset-inline($values, $exclude: ()) {
+ @include directional-property(inset-inline, $values, $exclude);
+}
+
+@mixin top($value, $exclude: ()) {
+ @include directional-property(top, $value, $exclude);
+}
+
+@mixin right($value, $exclude: ()) {
+ @include directional-property(right, $value, $exclude);
+}
+
+@mixin bottom($value, $exclude: ()) {
+ @include directional-property(bottom, $value, $exclude);
+}
+
+@mixin left($value, $exclude: ()) {
+ @include directional-property(left, $value, $exclude);
+}
+
+// =======================================================================
+// 快捷混合宏:尺寸属性
+// =======================================================================
+@mixin block-size($value, $exclude: ()) {
+ @include directional-property(block-size, $value, $exclude);
+}
+
+@mixin inline-size($value, $exclude: ()) {
+ @include directional-property(inline-size, $value, $exclude);
+}
+
+// =======================================================================
+// 组合混合宏
+// =======================================================================
+// 带圆角的边框
+@mixin bordered($border-value, $radius-value) {
+ @include border($border-value);
+ @include border-radius($radius-value);
+}
+
+// 绝对定位容器
+@mixin absolute-container($inset: 0) {
+ position: absolute;
+ @include inset($inset);
+}
+
+// 固定定位容器
+@mixin fixed-container($inset: 0) {
+ position: fixed;
+ @include inset($inset);
+}
+
+// =======================================================================
+// 圆角辅助混合宏
+// =======================================================================
+@mixin border-top-radius($value) {
+ @include border-radius($value 0 0, (bottom-right, bottom-left));
+}
+
+@mixin border-right-radius($value) {
+ @include border-radius(0 $value 0 0, (top-left, bottom-left));
+}
+
+@mixin border-bottom-radius($value) {
+ @include border-radius(0 0 $value, (top-right, top-left));
+}
+
+@mixin border-left-radius($value) {
+ @include border-radius(0 0 0 $value, (top-right, bottom-right));
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/mixins/ellipsis.scss b/uni_modules/lime-style/mixins/ellipsis.scss
new file mode 100644
index 0000000..97e762a
--- /dev/null
+++ b/uni_modules/lime-style/mixins/ellipsis.scss
@@ -0,0 +1,22 @@
+@mixin ellipsis {
+ // overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ /* #ifndef UNI-APP-X && APP || APP-NVUE */
+ word-wrap: normal;
+ /* #endif */
+}
+
+
+@mixin ellipsisLn($line) {
+ // overflow: hidden;
+ text-overflow: ellipsis;
+ /* #ifdef UNI-APP-X && APP || APP-NVUE */
+ lines: $line;
+ /* #endif */
+ /* #ifndef UNI-APP-X && APP || APP-NVUE */
+ -webkit-line-clamp: $line;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ /* #endif */
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/mixins/flex.scss b/uni_modules/lime-style/mixins/flex.scss
new file mode 100644
index 0000000..0c3dd84
--- /dev/null
+++ b/uni_modules/lime-style/mixins/flex.scss
@@ -0,0 +1,20 @@
+@mixin flex {
+ /* #ifndef UNI-APP-X */
+ display: flex;
+ /* #endif */
+}
+@mixin flex-column {
+ /* #ifndef UNI-APP-X */
+ flex-direction: column;
+ /* #endif */
+}
+@mixin flex-row {
+ flex-direction: row;
+}
+
+@mixin universal {
+ position: relative;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+}
diff --git a/uni_modules/lime-style/mixins/hairline.scss b/uni_modules/lime-style/mixins/hairline.scss
new file mode 100644
index 0000000..5044518
--- /dev/null
+++ b/uni_modules/lime-style/mixins/hairline.scss
@@ -0,0 +1,66 @@
+// @import '../theme/default.scss';
+
+@mixin hairline-base {
+ position: absolute;
+ box-sizing: border-box;
+ content: ' ';
+ pointer-events: none;
+ transform-origin: center; /* cover wechat button:after default transforn-origin */
+}
+
+@mixin hairline($color: $border-color-2) {
+ @include hairline-base;
+ top: -50%;
+ right: -50%;
+ bottom: -50%;
+ left: -50%;
+ border: 1px solid $color;
+ transform: scale(.5);
+}
+
+@mixin hairline-top($color: $border-color-1, $left: 0, $right: 0) {
+ @include hairline-base;
+ top: 0;
+ right: $right;
+ left: $left;
+ border-top: 1px solid $color;
+ transform: scaleY(0.5);
+}
+
+@mixin hairline-bottom($color: $border-color-1, $left: 0, $right: 0) {
+ @include hairline-base;
+ right: $right;
+ bottom: 0;
+ left: $left;
+ border-bottom: 1px solid $color;
+ transform: scaleY(0.5);
+}
+
+@mixin hairline-left($color: $border-bolor-1) {
+ @include hairline-base;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ border-left: 1px solid $color;
+ transform: scaleX(.5);
+}
+
+@mixin hairline-right($color: $border-bolor-1) {
+ @include hairline-base;
+ top: 0;
+ bottom: 0;
+ right: 0;
+ border-right: 1px solid $color;
+ transform: scaleX(.5);
+}
+
+// @mixin border {
+// /* #ifndef UNI-APP-X && APP */
+// &:after {
+// @content;
+// }
+// /* #endif */
+// /* #ifdef UNI-APP-X && APP */
+// @content;
+// /* #endif */
+// }
\ No newline at end of file
diff --git a/uni_modules/lime-style/mixins/platform.scss b/uni_modules/lime-style/mixins/platform.scss
new file mode 100644
index 0000000..ebd3c8f
--- /dev/null
+++ b/uni_modules/lime-style/mixins/platform.scss
@@ -0,0 +1,17 @@
+/* #ifdef APP-NVUE || UNI-APP-X && APP */
+$is-app: true;
+/* #endif */
+/* #ifndef APP-NVUE || UNI-APP-X && APP */
+$is-app: false;
+/* #endif */
+
+@mixin is-app {
+ @if $is-app {
+ @content;
+ }
+}
+@mixin not-app {
+ @if not($is-app) {
+ @content;
+ }
+}
diff --git a/uni_modules/lime-style/mixins/useTheme.scss b/uni_modules/lime-style/mixins/useTheme.scss
new file mode 100644
index 0000000..83df7ca
--- /dev/null
+++ b/uni_modules/lime-style/mixins/useTheme.scss
@@ -0,0 +1,60 @@
+$limeThemes: light, dark;
+$theme: light;
+
+@mixin use-theme($mode: null) {
+ @if $mode != null {
+ /* #ifndef UNI-APP-X && APP || APP-NVUE */
+ @media (prefers-color-scheme: $mode) {
+ @content;
+ }
+ /* #endif */
+ /* #ifdef UNI-APP-X && APP || APP-NVUE */
+ &.#{$mode} {
+ @content;
+ }
+ /* #endif */
+ } @else {
+ @each $mode in $limeThemes {
+ $theme: $mode !global;
+ /* #ifndef UNI-APP-X && APP || APP-NVUE */
+ @media (prefers-color-scheme: $mode) {
+ @content;
+ }
+ /* #endif */
+
+ /* #ifdef UNI-APP-X && APP || APP-NVUE */
+ &.#{$mode} {
+ @content;
+ }
+ /* #endif */
+ }
+ }
+
+}
+
+@mixin theme-dark {
+ /* #ifndef UNI-APP-X && APP || APP-NVUE */
+ @media (prefers-color-scheme: dark) {
+ page {
+ @content;
+ }
+ }
+ /* #endif */
+ /* #ifdef UNI-APP-X && APP || APP-NVUE */
+ .dark {
+ @content;
+ }
+ /* #endif */
+ /* #ifdef WEB */
+ :root[data-lime-theme='dark'] page {
+ @content;
+ }
+ /* #endif */
+}
+
+
+@function get-var($themes, $key) {
+ @return map-get($themes, $key)
+}
+
+
diff --git a/uni_modules/lime-style/mixins/utilities.scss b/uni_modules/lime-style/mixins/utilities.scss
new file mode 100644
index 0000000..3a4ea4a
--- /dev/null
+++ b/uni_modules/lime-style/mixins/utilities.scss
@@ -0,0 +1,7 @@
+@import './flex';
+
+@mixin resize-none {
+ /* #ifndef UNI-APP-X && APP */
+ resize: none;
+ /* #endif */
+}
diff --git a/uni_modules/lime-style/package.json b/uni_modules/lime-style/package.json
new file mode 100644
index 0000000..4b38aaa
--- /dev/null
+++ b/uni_modules/lime-style/package.json
@@ -0,0 +1,103 @@
+{
+ "id": "lime-style",
+ "displayName": "lime-style",
+ "version": "0.2.4",
+ "description": "lime-style",
+ "keywords": [
+ "lime-style"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.1.0",
+ "uni-app": "^4.44",
+ "uni-app-x": "^4.61"
+ },
+ "dcloudext": {
+ "type": "sdk-js",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "",
+ "darkmode": "x",
+ "i18n": "x",
+ "widescreen": "x"
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "√",
+ "aliyun": "√",
+ "alipay": "√"
+ },
+ "client": {
+ "uni-app": {
+ "vue": {
+ "vue2": "√",
+ "vue3": "√"
+ },
+ "web": {
+ "safari": "√",
+ "chrome": "√"
+ },
+ "app": {
+ "vue": "√",
+ "nvue": "√",
+ "android": {
+ "extVersion": "",
+ "minVersion": "22"
+ },
+ "ios": "√",
+ "harmony": "√"
+ },
+ "mp": {
+ "weixin": "√",
+ "alipay": "√",
+ "toutiao": "√",
+ "baidu": "√",
+ "kuaishou": "√",
+ "jd": "√",
+ "harmony": "-",
+ "qq": "-",
+ "lark": "-"
+ },
+ "quickapp": {
+ "huawei": "-",
+ "union": "-"
+ }
+ },
+ "uni-app-x": {
+ "web": {
+ "safari": "√",
+ "chrome": "√"
+ },
+ "app": {
+ "android": {
+ "extVersion": "",
+ "minVersion": "22"
+ },
+ "ios": "√",
+ "harmony": "√"
+ },
+ "mp": {
+ "weixin": "√"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/readme.md b/uni_modules/lime-style/readme.md
new file mode 100644
index 0000000..0f53a25
--- /dev/null
+++ b/uni_modules/lime-style/readme.md
@@ -0,0 +1,16 @@
+# lime-style
+
+## 更换色系
+在uni.scss中增加
+```css
+// 品牌色-主色
+$primary-color: #3283ff;
+// 错误色
+$error-color: #FF4D4F;
+// 警告色
+$warning-color: #ffb400;
+// 成功色
+$success-color: #34c471;
+
+$blue: #3283ff;
+```
\ No newline at end of file
diff --git a/uni_modules/lime-style/theme/dark.scss b/uni_modules/lime-style/theme/dark.scss
new file mode 100644
index 0000000..0c8a17e
--- /dev/null
+++ b/uni_modules/lime-style/theme/dark.scss
@@ -0,0 +1,635 @@
+@import '../mixins/create.scss';
+@import '../color/colorPalette.scss';
+@import '../color/colors.scss';
+@import '../mixins/useTheme';
+
+$blue-1: #{genColor($blue, 1, dark)};
+$blue-2: #{genColor($blue, 2, dark)};
+$blue-3: #{genColor($blue, 3, dark)};
+$blue-4: #{genColor($blue, 4, dark)};
+$blue-5: #{genColor($blue, 5, dark)};
+$blue-6: #{genColor($blue, 6, dark)};
+$blue-7: #{genColor($blue, 7, dark)};
+$blue-8: #{genColor($blue, 8, dark)};
+$blue-9: #{genColor($blue, 9, dark)};
+$blue-10: #{genColor($blue, 10, dark)};
+
+$info-color-1: #{genColor($info-color, 1, dark)};
+$info-color-2: #{genColor($info-color, 2, dark)};
+$info-color-3: #{genColor($info-color, 3, dark)};
+$info-color-4: #{genColor($info-color, 4, dark)};
+$info-color-5: #{genColor($info-color, 5, dark)};
+$info-color-6: #{genColor($info-color, 6, dark)};
+$info-color-7: #{genColor($info-color, 7, dark)};
+$info-color-8: #{genColor($info-color, 8, dark)};
+$info-color-9: #{genColor($info-color, 9, dark)};
+$info-color-10: #{genColor($info-color, 10, dark)};
+
+$primary-color-1: #{genColor($primary-color, 1, dark)}; // 浅色/白底悬浮
+$primary-color-2: #{genColor($primary-color, 2, dark)}; // 文字禁用
+$primary-color-3: #{genColor($primary-color, 3, dark)}; // 一般禁用
+$primary-color-4: #{genColor($primary-color, 4, dark)}; // 特殊场景 禁用
+$primary-color-5: #{genColor($primary-color, 5, dark)}; // 悬浮
+$primary-color-6: #{genColor($primary-color, 6, dark)}; // 常规
+$primary-color-7: #{genColor($primary-color, 7, dark)}; // 点击
+$primary-color-8: #{genColor($primary-color, 8, dark)}; //
+$primary-color-9: #{genColor($primary-color, 9, dark)};
+$primary-color-10: #{genColor($primary-color, 10, dark)};
+
+$error-color-1: #{genColor($error-color, 1, dark)};
+$error-color-2: #{genColor($error-color, 2, dark)};
+$error-color-3: #{genColor($error-color, 3, dark)};
+$error-color-4: #{genColor($error-color, 4, dark)};
+$error-color-5: #{genColor($error-color, 5, dark)};
+$error-color-6: #{genColor($error-color, 6, dark)};
+$error-color-7: #{genColor($error-color, 7, dark)};
+$error-color-8: #{genColor($error-color, 8, dark)};
+$error-color-9: #{genColor($error-color, 9, dark)};
+$error-color-10: #{genColor($error-color, 10, dark)};
+
+$warning-color-1: #{genColor($warning-color, 1, dark)};
+$warning-color-2: #{genColor($warning-color, 2, dark)};
+$warning-color-3: #{genColor($warning-color, 3, dark)};
+$warning-color-4: #{genColor($warning-color, 4, dark)};
+$warning-color-5: #{genColor($warning-color, 5, dark)};
+$warning-color-6: #{genColor($warning-color, 6, dark)};
+$warning-color-7: #{genColor($warning-color, 7, dark)};
+$warning-color-8: #{genColor($warning-color, 8, dark)};
+$warning-color-9: #{genColor($warning-color, 9, dark)};
+$warning-color-10: #{genColor($warning-color, 10, dark)};
+
+$success-color-1: #{genColor($success-color, 1, dark)}; // 浅色/白底悬浮
+$success-color-2: #{genColor($success-color, 2, dark)}; // 文字禁用
+$success-color-3: #{genColor($success-color, 3, dark)}; // 一般禁用
+$success-color-4: #{genColor($success-color, 4, dark)}; // 特殊场景
+$success-color-5: #{genColor($success-color, 5, dark)}; // 悬浮
+$success-color-6: #{genColor($success-color, 6, dark)}; // 常规
+$success-color-7: #{genColor($success-color, 7, dark)}; // 点击
+$success-color-8: #{genColor($success-color, 8, dark)};
+$success-color-9: #{genColor($success-color, 9, dark)};
+$success-color-10: #{genColor($success-color, 10, dark)};
+
+// $gray-1: #f3f3f3;
+// $gray-2: #eeeeee;
+// $gray-3: #e7e7e7;
+// $gray-4: #dcdcdc;
+// $gray-5: #c5c5c5;
+// $gray-6: #a6a6a6;
+// $gray-7: #8b8b8b;
+// $gray-8: #777777;
+// $gray-9: #5e5e5e;
+// $gray-10: #4b4b4b;
+// $gray-11: #383838;
+// $gray-12: #2c2c2c;
+// $gray-13: #242424;
+// $gray-14: #181818;
+
+// 暗色模式的灰度
+$gray-1: #181818; // 最深
+$gray-2: #242424;
+$gray-3: #2c2c2c;
+$gray-4: #383838;
+$gray-5: #4b4b4b;
+$gray-6: #5e5e5e;
+$gray-7: #777777;
+$gray-8: #8b8b8b;
+$gray-9: #a6a6a6;
+$gray-10: #c5c5c5;
+$gray-11: #dcdcdc;
+$gray-12: #e7e7e7;
+$gray-13: #eeeeee;
+$gray-14: #f3f3f3; // 最浅
+
+$text-color-1: rgba(255,255,255,0.85); //primary
+$text-color-2: rgba(255,255,255,0.65); //secondary
+$text-color-3: rgba(255,255,255,0.45); //placeholder
+$text-color-4: rgba(255,255,255,0.25); //disabled
+
+// 容器
+$bg-color-page: $gray-1;//#000000; // 整体背景色 布局
+$bg-color-container: $gray-2;//#1d1d1d; // 一级容器背景 组件
+$bg-color-elevated: $gray-2;//#1f1f1f; // 二级容器背景 浮层
+$bg-color-spotlight: $gray-5; // 引起注意的如 Tooltip
+$bg-color-mask: rgba(0, 0, 0, 0.65); // 蒙层
+
+// 填充
+$fill-1: rgba(255,255,255,0.18);
+$fill-2: rgba(255,255,255,0.12);
+$fill-3: rgba(255,255,255,0.08);
+$fill-4: rgba(255,255,255,0.04);
+
+// 描边
+$border-color-1: $gray-3;//#{getSolidColor(#000, 26%)}; //#424242; // 浅色
+$border-color-2: $gray-4;//#{getSolidColor(#000, 19%)}; //#303030; // 一般
+$border-color-3: $gray-5;//#{getSolidColor(#000, 15%)}; //$gray-4; // 深/悬浮
+$border-color-4: $gray-6;//#{getSolidColor(#000, 12%)}; //$gray-6; // 重/按钮描边
+
+
+@mixin theme-dark {
+ // 蓝色系
+ --l-blue-1: #{$blue-1};
+ --l-blue-2: #{$blue-2};
+ --l-blue-3: #{$blue-3};
+ --l-blue-4: #{$blue-4};
+ --l-blue-5: #{$blue-5};
+ --l-blue-6: #{$blue-6};
+ --l-blue-7: #{$blue-7};
+ --l-blue-8: #{$blue-8};
+ --l-blue-9: #{$blue-9};
+ --l-blue-10: #{$blue-10};
+
+ --l-info-color-1: #{$info-color-1};
+ --l-info-color-2: #{$info-color-2};
+ --l-info-color-3: #{$info-color-3};
+ --l-info-color-4: #{$info-color-4};
+ --l-info-color-5: #{$info-color-5};
+ --l-info-color-6: #{$info-color-6};
+ --l-info-color-7: #{$info-color-7};
+ --l-info-color-8: #{$info-color-8};
+ --l-info-color-9: #{$info-color-9};
+ --l-info-color-10: #{$info-color-10};
+
+ // 主色系
+ --l-primary-color-1: #{$primary-color-1};
+ --l-primary-color-2: #{$primary-color-2};
+ --l-primary-color-3: #{$primary-color-3};
+ --l-primary-color-4: #{$primary-color-4};
+ --l-primary-color-5: #{$primary-color-5};
+ --l-primary-color-6: #{$primary-color-6};
+ --l-primary-color-7: #{$primary-color-7};
+ --l-primary-color-8: #{$primary-color-8};
+ --l-primary-color-9: #{$primary-color-9};
+ --l-primary-color-10: #{$primary-color-10};
+
+ // 错误色系
+ --l-error-color-1: #{$error-color-1};
+ --l-error-color-2: #{$error-color-2};
+ --l-error-color-3: #{$error-color-3};
+ --l-error-color-4: #{$error-color-4};
+ --l-error-color-5: #{$error-color-5};
+ --l-error-color-6: #{$error-color-6};
+ --l-error-color-7: #{$error-color-7};
+ --l-error-color-8: #{$error-color-8};
+ --l-error-color-9: #{$error-color-9};
+ --l-error-color-10: #{$error-color-10};
+
+ // 警告色系
+ --l-warning-color-1: #{$warning-color-1};
+ --l-warning-color-2: #{$warning-color-2};
+ --l-warning-color-3: #{$warning-color-3};
+ --l-warning-color-4: #{$warning-color-4};
+ --l-warning-color-5: #{$warning-color-5};
+ --l-warning-color-6: #{$warning-color-6};
+ --l-warning-color-7: #{$warning-color-7};
+ --l-warning-color-8: #{$warning-color-8};
+ --l-warning-color-9: #{$warning-color-9};
+ --l-warning-color-10: #{$warning-color-10};
+
+ // 成功色系
+ --l-success-color-1: #{$success-color-1};
+ --l-success-color-2: #{$success-color-2};
+ --l-success-color-3: #{$success-color-3};
+ --l-success-color-4: #{$success-color-4};
+ --l-success-color-5: #{$success-color-5};
+ --l-success-color-6: #{$success-color-6};
+ --l-success-color-7: #{$success-color-7};
+ --l-success-color-8: #{$success-color-8};
+ --l-success-color-9: #{$success-color-9};
+ --l-success-color-10: #{$success-color-10};
+
+ // 灰色系
+ --l-gray-1: #{$gray-1};
+ --l-gray-2: #{$gray-2};
+ --l-gray-3: #{$gray-3};
+ --l-gray-4: #{$gray-4};
+ --l-gray-5: #{$gray-5};
+ --l-gray-6: #{$gray-6};
+ --l-gray-7: #{$gray-7};
+ --l-gray-8: #{$gray-8};
+ --l-gray-9: #{$gray-9};
+ --l-gray-10: #{$gray-10};
+ --l-gray-11: #{$gray-11};
+ --l-gray-12: #{$gray-12};
+ --l-gray-13: #{$gray-13};
+ --l-gray-14: #{$gray-14};
+
+ // 文字颜色
+ --l-text-color-1: #{$text-color-1};
+ --l-text-color-2: #{$text-color-2};
+ --l-text-color-3: #{$text-color-3};
+ --l-text-color-4: #{$text-color-4};
+
+ // 容器背景色
+ --l-bg-color-page: #{$bg-color-page};
+ --l-bg-color-container: #{$bg-color-container};
+ --l-bg-color-elevated: #{$bg-color-elevated};
+ --l-bg-color-spotlight: #{$bg-color-spotlight};
+ --l-bg-color-mask: #{$bg-color-mask};
+
+ // 填充色
+ --l-fill-1: #{$fill-1};
+ --l-fill-2: #{$fill-2};
+ --l-fill-3: #{$fill-3};
+ --l-fill-4: #{$fill-4};
+
+ // 描边色
+ --l-border-color-1: #{$border-color-1};
+ --l-border-color-2: #{$border-color-2};
+ --l-border-color-3: #{$border-color-3};
+ --l-border-color-4: #{$border-color-4};
+
+ // loading
+ --l-loading-text-color: #{$text-color-3};
+
+ // load-more
+ --l-load-more-text-color: #{$text-color-3};
+ --l-load-more-color: #{$text-color-4};
+
+ // 按钮
+ --l-button-default-solid-text-color: #000;
+ --l-button-default-border-color: #{$gray-5};
+ --l-button-default-color: #{$gray-14};
+ --l-button-default-light-color: #{$gray-4};
+ --l-button-default-light-hover-color: #{$gray-5};
+ --l-button-primary-light-color: #{$primary-color-2};
+ --l-button-primary-light-hover-color: #{$primary-color-3};
+ --l-button-danger-light-color: #{$error-color-2};
+ --l-button-danger-light-hover-color: #{$error-color-3};
+ --l-button-warning-light-color: #{$warning-color-2};
+ --l-button-warning-light-hover-color: #{$warning-color-3};
+ --l-button-success-light-color: #{$success-color-2};
+ --l-button-success-light-hover-color: #{$success-color-3};
+ --l-button-info-light-color: #{$info-color-1};
+ --l-button-info-light-hover-color: #{$info-color-2};
+ --l-button-primary-color: #{$primary-color-6};
+ --l-button-danger-color: #{$error-color-6};
+ --l-button-warning-color: #{$warning-color-6};
+ --l-button-info-color: #{$info-color-6};
+
+ // 遮罩
+ // --l-overlay-bg-color: #{$bg-color-mask};
+ // 弹窗
+ --l-popup-bg-color: #{$bg-color-elevated};
+ --l-popup-close-icon-color: #{$text-color-2};
+
+ // 单元格
+ --l-cell-group-title-color: #{$text-color-3};
+ --l-cell-group-border-color: #{$border-color-3};
+ --l-cell-bg-color: #{$bg-color-container};
+ --l-cell-hover-color: #{$gray-3};
+ --l-cell-border-color: #{$border-color-2};
+ --l-cell-note-color: #{$text-color-3};
+ --l-cell-description-color: #{$text-color-2};
+ --l-cell-title-color: #{$text-color-1};
+ --l-cell-right-icon-color: #{$text-color-3};
+
+ // 步进器
+ --l-stepper-button-bg-color: #{$gray-4};
+ --l-stepper-input-disabled-bg: #{$gray-3};
+ --l-stepper-input-color: #{$text-color-1};
+ --l-stepper-input-disabled-color: #{$text-color-4};
+ --l-stepper-border-color: #{$gray-4};
+
+ // tabbar
+ --l-tabbar-bg-color: #{$bg-color-container};
+ --l-tabbar-border-color: #{$border-color-1};
+ --l-tabbar-color: #{$text-color-1};
+ --l-tabbar-active-color: #{$primary-color-6};
+ --l-tabbar-active-bg-color: #{$primary-color-1};
+
+ // link
+ --l-link-default-color: #{$text-color-1};
+
+ // image
+ --l-image-loading-bg-color: #{$fill-3};
+ --l-image-color: #{$text-color-3};
+
+ // divider 分割线
+ --l-divider-color: #{$border-color-2};
+ --l-divider-text-color: #{$text-color-2};
+
+ // card 卡片
+ --l-card-bg-color: #{$bg-color-container};
+ --l-card-title-color: #{$text-color-1};
+ --l-card-extra-color: #{$text-color-3};
+ --l-card-note-color: #{$text-color-3};
+ --l-card-border-color: #{$border-color-2};
+
+ // grid 宫格
+ --l-grid-item-bg-color: #{$bg-color-container};
+ --l-grid-item-image-bg-color: #{$fill-4};
+ --l-grid-item-text-color: #{$text-color-1};
+ --l-grid-item-hover-bg-color: #{$fill-3};
+ --l-grid-item-description-color: #{$text-color-3};
+ --l-grid-item-border-color: #{$border-color-2};
+ --l-grid-item-icon-color: #{$text-color-1};
+
+ // cascader 级联
+ --l-cascader-title-color: #{$text-color-1};
+ --l-cascader-bg-color: #{$bg-color-container};
+ --l-cascader-cell-title-color: #{$text-color-1};
+ --l-cascader-disabled-color: #{$text-color-3};
+ --l-cascader-options-title-color: #{$text-color-3};
+ --l-cascader-close-icon-color: #{$text-color-2};
+
+ // tabs 标签页
+ --l-tab-nav-bg-color: #{$bg-color-container};
+ --l-tab-content-bg-color: #{$bg-color-container};
+ --l-tab-split-color: #{$border-color-1};
+ --l-tab-item-color: #{$text-color-2};
+ --l-tab-item-disabled-color: #{$text-color-4};
+
+ // checkbox 复选框
+ --l-checkbox-border-icon-color: #{$gray-8};
+ --l-checkbox-icon-bg-color: #{$bg-color-container};
+ --l-checkbox-text-color: #{$text-color-1};
+ --l-checkbox-icon-disabled-bg-color: #{$gray-3};
+ --l-checkbox-icon-disabled-color: #{$gray-6};
+
+ // radio 单选框
+ --l-radio-border-icon-color: #{$gray-8};
+ --l-radio-icon-bg-color: #{$bg-color-container};
+ --l-radio-text-color: #{$text-color-1};
+ --l-radio-icon-disabled-bg-color: #{$gray-3};
+ --l-radio-icon-disabled-color: #{$gray-6};
+
+ // search 搜索
+ --l-search-bg-color: #{$fill-3};
+ --l-search-icon-color: #{$text-color-4};
+ --l-search-clear-icon-color: #{$text-color-4};
+ --l-search-text-color: #{$text-color-1};
+ --l-search-label-color: #{$text-color-1};
+ --l-search-placeholder-color: #{$text-color-3};
+
+ // switch
+ --l-switch-checked-disabled-color: #{$primary-color-3};
+ --l-switch-unchecked-color: #{$gray-5};
+ --l-switch-unchecked-disabled-color: #{$gray-4};
+
+ // input 输入框
+ --l-input-text-color: #{$text-color-1};
+ --l-input-tips-color: #{$text-color-3};
+ --l-input-bg-color: #{$bg-color-container};
+ --l-input-border-color: #{$border-color-2};
+ --l-input-placeholder-text-color: #{$text-color-3};
+ --l-input-prefix-icon-color: #{$text-color-1};
+ --l-input-suffix-icon-color: #{$text-color-3};
+ --l-input-label-text-color: #{$text-color-1};
+ --l-input-suffix-text-color: #{$text-color-1};
+ --l-input-disabled-text-color: #{$text-color-4};
+ --l-input-disabled-bg-color: #{$fill-3};
+ --l-input-border-color: #{$border-color-2};
+
+ // textarea
+ --l-textarea-bg-color: #{$bg-color-container};
+ --l-textarea-placeholder-color: #{$text-color-3};
+ --l-textarea-text-color: #{$text-color-1};
+ --l-textarea-label-color: #{$text-color-1};
+ --l-textarea-indicator-text-color: #{$text-color-3};
+ --l-textarea-border-color: #{$border-color-2};
+ --l-textarea-disabled-text-color: #{$text-color-4};
+
+ // upload
+ --l-upload-bg-color: #{$gray-4};
+ --l-upload-add-bg-color: #{$gray-4};
+ --l-upload-add-color: #{$text-color-3};
+
+ // picker
+ --l-picker-bg-color: #{$bg-color-container};
+ --l-picker-cancel-color: #{$text-color-2};
+ --l-picker-title-color: #{$text-color-1};
+ --l-picker-item-active-color: #{$text-color-1};
+ --l-picker-mask-top-color: #{$gray-2};
+ --l-picker-loading-mask-color: rgba(0,0,0,.6);
+ --l-picker-item-color: #{$text-color-1};
+ --l-picker-indicator-bg-color: #{$fill-3};
+
+ // empty
+ --l-empty-opacity: 0.6;
+
+ // segmented
+ --l-segmented-bg-color: #{$gray-4};
+ --l-segmented-text-color: #{$text-color-2};
+ --l-segmented-active-bg-color: #{$gray-5};
+
+ // keyboard
+ --l-keyboard-bg-color: #{$bg-color-elevated};
+ --l-keyboard-color: #{$text-color-1};
+ --l-keyboard-key-bg-color: #{$gray-5};
+ --l-keyboard-key-hover-bg-color: #{$gray-4};
+ --l-keyboard-icon-bg-color: #{$gray-5};
+ --l-keyboard-icon-color: #{$text-color-3};
+
+ // code-input
+ --l-code-input-bg-color: #{$gray-4};
+ --l-code-input-active-bg-color: #{$gray-5};
+ --l-code-input-info-color: #{$text-color-3};
+ --l-code-input-dot-color: #{$text-color-1};
+ --l-code-input-text-color: #{$text-color-1};
+ --l-code-input-cursor-color: #{$text-color-1};
+ --l-code-input-active-border-color: #{$gray-6};
+
+ // steps
+ --l-step-description-color: #{$text-color-3};
+ --l-step-wait-circle-bg-color: #{$gray-4};
+ --l-step-wait-circle-color: #{$text-color-3};
+ --l-step-wait-title-color: #{$text-color-3};
+ --l-step-wait-icon-color: #{$text-color-3};
+ --l-step-wait-dot-border-color: #{$gray-5};
+ --l-step-line-color: #{$gray-5};
+ --l-step-finish-title-color: #{$text-color-1};
+ --l-step-finish-circle-bg-color: #{$primary-color-2};
+ --l-step-error-circle-bg-color: #{$error-color-2};
+
+ // date-strip
+ --l-date-strip-bg-color: #{$bg-color-container};
+ --l-date-strip-color: #{$text-color-1};
+ --l-date-strip-prefix-color: #{$text-color-3};
+ --l-date-strip-color: #{$text-color-2};
+
+ // slider
+ --l-slider-rail-color: #{$gray-5};
+ --l-slider-thumb-border-color: #{$gray-11};
+
+ // form
+ --l-form-item-border-color: #{$border-color-2};
+ --l-form-bg-color: #{$bg-color-container};
+ --l-form-item-label-color: #{$text-color-1};
+
+ // color-picker
+ --l-color-picker-color: #{$text-color-1};
+ --l-color-picker-label-color: #{$text-color-2};
+ --l-color-picker-field-bg-color: #{$fill-2};
+ --l-color-picker-divider-color: #{$border-color-2};
+
+ // calendar
+ --l-calendar-bg-color: #{$bg-color-container};
+ --l-calendar-title-color: #{$text-color-1};
+ --l-calendar-days-color: #{$text-color-2};
+ --l-calendar-item-color: #{$text-color-1};
+ --l-calendar-item-disabled-color: #{$text-color-4};
+ --l-calendar-item-centre-color: #{$primary-color-2};
+ --l-calendar-month-mark-color: #{$fill-3};
+ --l-calendar-switch-mode-icon-color: #{$text-color-2};
+ --l-calendar-switch-mode-icon-disabled-color: #{$text-color-4};
+ --l-calendar-header-border-color: #{$border-color-2};
+
+ // loading
+ --l-loading-text-color: #{$text-color-3};
+
+ // dialog
+ --l-dialog-title-color: #{$text-color-1};
+ --l-dialog-content-color: #{$text-color-2};
+ --l-dialog-close-color: #{$text-color-3};
+ // --l-dialog-bg-color: #{$bg-color-container};
+ --l-dialog-bg-color: #{$gray-3};
+ --l-dialog-split-color: #{$border-color-2};
+
+ // action-sheet
+ --l-action-sheet-item-disabled-color: #{$text-color-4};
+ --l-action-sheet-hover-color: #{$gray-3};
+ --l-action-sheet-border-color: #{$border-color-1};
+ --l-action-sheet-gap-color: #{$bg-color-page};
+ --l-action-sheet-color: #{$text-color-1};
+ --l-action-sheet-description-color: #{$text-color-3};
+ --l-action-sheet-cancel-color: #{$text-color-1};
+ --l-action-sheet-cancel-bg-color: #{$bg-color-container};
+ --l-action-sheet-image-bg-color: #{$fill-3};
+ --l-action-sheet-title-color: #{$text-color-1};
+ --l-action-sheet-close-btn-color: #{$text-color-1};
+
+ // sorter
+ --l-sorter-color: #{$text-color-1};
+
+ // floating-panel
+ --l-floating-panel-bg-color: #{$bg-color-elevated};
+ --l-floating-panel-bar-color: #{$fill-1};
+
+ // dropdown-menu
+ --l-dropdown-menu-color: #{$text-color-1};
+ --l-dropdown-menu-bg-color: #{$bg-color-container};
+ --l-dropdown-menu-border-color: #{$border-color-1};
+ --l-dropdown-menu-disabled-color: #{$border-color-3};
+ --l-dropdown-menu-arrow-color: #{$gray-6};
+ --l-dropdown-menu-arrow-active-color: #{$gray-4};
+ --l-dropdown-item-cell-title-color: #{$text-color-1};
+
+ // pull-refresh
+ --l-pull-refresh-refresher-color: #{$text-color-2};
+
+ // circle
+ --l-circle-trail-color: #{$gray-5};
+
+ // collapse
+ --l-collapse-panel-bg-color: #{$bg-color-container};
+ --l-collapse-content-text-color: #{$text-color-1};
+ --l-collapse-right-icon-color: #{$text-color-4};
+ --l-collapse-border-color: #{$border-color-2};
+
+ // count-down
+ --l-count-down-text-color: #{$text-color-1};
+
+ // empty
+ --l-empty-description-color: #{$text-color-3};
+ // progress
+ --l-progress-trail-color: #{$gray-5};
+ --l-progress-text-color: #{$text-color-2};
+
+ // tag
+ // --l-tag-default-solid-text-color: #000;
+ --l-tag-text-color: #{$gray-14};
+ --l-tag-default-color: #{$gray-6};
+ --l-tag-default-light-color: #{$gray-4};
+ --l-tag-default-border-color: #{$gray-5};
+ --l-tag-primary-light-color: #{$primary-color-2};
+ --l-tag-danger-light-color: #{$error-color-2};
+ --l-tag-warning-light-color: #{$warning-color-2};
+ --l-tag-success-light-color: #{$success-color-2};
+
+ // amount
+ --l-amount-color: #{$text-color-1};
+
+ // avatar
+ --l-avatar-bg-color: #{$primary-color-1};
+ --l-avatar-border-color: #{$gray-2};
+
+ // highlight
+ --l-highlight-normal-color: #{$text-color-1};
+
+ // text-ellipsis
+ --l-text-ellipsis-color: #{$text-color-1};
+
+ // read-more
+ --l-read-more-handle-color: #{$text-color-2};
+ --l-read-more-read-start: rgba(36, 36, 36, 0.9);
+ --l-read-more-read-end: rgba(36, 36, 36, 0.3);
+ --l-read-more-mask-bg-color: linear-gradient(
+ to top,
+ rgba(0,0,0,0),
+ rgba(0,0,0,1),
+ );
+ // notice-bar
+ --l-notice-bar-info-bg-color: #{$info-color-1};
+ --l-notice-bar-success-bg-color: #{$success-color-1};
+ --l-notice-bar-warning-bg-color: #{$warning-color-1};
+ --l-notice-bar-danger-bg-color: #{$error-color-1};
+
+ // scrollx
+ --l-scrollx-track-color: #{$gray-4};
+
+ // dateformat
+ --l-dateformat-color: #{$text-color-1};
+
+ // footer
+ --l-footer-text-color: #{$text-color-3};
+ --l-footer-link-dividing-line-color: #{$text-color-3};
+ --l-footer-logo-title-color: #{$text-color-1};
+
+ // tree
+ --l-tree-node-text-color: #{$text-color-1};
+ --l-tree-arrow-color: #{$gray-6};
+
+ // table
+ --l-table-bg-color: #{$bg-color-container};
+ --l-table-border-color: #{$border-color-2};
+ --l-table-td-fixed-bg-color: #{$bg-color-container};
+ --l-table-tr-fixed-bg-color: #{$bg-color-container};
+
+ // sidebar
+ --l-sidebar-bg-color: #{$gray-3};
+ --l-sidebar-selected-bg-color: #{$bg-color-container};
+ --l-sidebar-text-color: #{$text-color-2};
+ --l-sidebar-disabled-text-color: #{$text-color-4};
+
+ // back-top
+ --l-back-top-bg-color: #{$bg-color-elevated};
+ --l-back-top-border-color: #{$border-color-2};
+ --l-back-top-text-color: #{$text-color-2};
+
+ // navbar
+ --l-navbar-bg-color: #{$bg-color-container};
+ --l-navbar-color: #{$text-color-1};
+ --l-navbar-capsule-border-color: #{$border-color-2};
+
+ // pagination
+ --l-pagination-bg-color: #{$gray-4};
+ --l-pagination-disabled-bg-color: #{$gray-3};
+ --l-pagination-hover-bg-color: #{$gray-5};
+ --l-pagination-text-color: #{$text-color-2};
+ --l-pagination-disabled-color: #{$text-color-4};
+ --l-pagination-simple-text-color: #{$text-color-1};
+
+ // indexes
+ --l-indexes-sidebar-color: #{$text-color-1};
+ --l-indexes-anchor-color: #{$text-color-1};
+ --l-indexes-anchor-bg-color: #{$gray-4};
+ --l-indexes-anchor-active-bg-color: #{$gray-4};
+ --l-indexes-sidebar-tips-bg-color: #{$primary-color-1};
+
+ // typing
+ --l-typing-bg-color: #{$bg-color-container};
+ --l-typing-text-color: #{$text-color-1};
+
+ // fit-swiper
+ --l-fit-swiper-indicator-color: #{$gray-5};
+}
diff --git a/uni_modules/lime-style/theme/default.scss b/uni_modules/lime-style/theme/default.scss
new file mode 100644
index 0000000..90aaba7
--- /dev/null
+++ b/uni_modules/lime-style/theme/default.scss
@@ -0,0 +1,181 @@
+@import '../mixins/create.scss';
+@import '../color/colorPalette.scss';
+@import '../color/colors.scss';
+
+$blue-1: genColor($blue, 1);
+$blue-2: genColor($blue, 2);
+$blue-3: genColor($blue, 3);
+$blue-4: genColor($blue, 4);
+$blue-5: genColor($blue, 5);
+$blue-6: $blue;
+$blue-7: genColor($blue, 7);
+$blue-8: genColor($blue, 8);
+$blue-9: genColor($blue, 9);
+$blue-10: genColor($blue, 10);
+
+$info-color-1: genColor($info-color, 1);
+$info-color-2: genColor($info-color, 2);
+$info-color-3: genColor($info-color, 3);
+$info-color-4: genColor($info-color, 4);
+$info-color-5: genColor($info-color, 5);
+$info-color-6: $info-color;
+$info-color-7: genColor($info-color, 7);
+$info-color-8: genColor($info-color, 8);
+$info-color-9: genColor($info-color, 9);
+$info-color-10: genColor($info-color, 10);
+
+$primary-color-1: create-var('primary-color-1', genColor($primary-color, 1)); // 浅色/白底悬浮
+$primary-color-2: create-var('primary-color-2', genColor($primary-color, 2)); // 文字禁用
+$primary-color-3: create-var('primary-color-3', genColor($primary-color, 3)); // 一般禁用
+$primary-color-4: create-var('primary-color-4', genColor($primary-color, 4)); // 特殊场景 禁用
+$primary-color-5: create-var('primary-color-5', genColor($primary-color, 5)); // 悬浮
+$primary-color-6: create-var('primary-color-6', $primary-color); // 常规
+$primary-color-7: create-var('primary-color-7', genColor($primary-color, 7)); // 点击
+$primary-color-8: create-var('primary-color-8', genColor($primary-color, 8)); //
+$primary-color-9: create-var('primary-color-9', genColor($primary-color, 9));
+$primary-color-10: create-var('primary-color-10', genColor($primary-color, 10));
+
+$error-color-1: create-var('error-color-1', genColor($error-color, 1));
+$error-color-2: create-var('error-color-2', genColor($error-color, 2));
+$error-color-3: create-var('error-color-3', genColor($error-color, 3));
+$error-color-4: create-var('error-color-4', genColor($error-color, 4));
+$error-color-5: create-var('error-color-5', genColor($error-color, 5));
+$error-color-6: create-var('error-color-6', $error-color);
+$error-color-7: create-var('error-color-7', genColor($error-color, 7));
+$error-color-8: create-var('error-color-8', genColor($error-color, 8));
+$error-color-9: create-var('error-color-9', genColor($error-color, 9));
+$error-color-10: create-var('error-color-10', genColor($error-color, 10));
+
+$warning-color-1: create-var('warning-color-1', genColor($warning-color, 1));
+$warning-color-2: create-var('warning-color-2', genColor($warning-color, 2));
+$warning-color-3: create-var('warning-color-3', genColor($warning-color, 3));
+$warning-color-4: create-var('warning-color-4', genColor($warning-color, 4));
+$warning-color-5: create-var('warning-color-5', genColor($warning-color, 5));
+$warning-color-6: create-var('warning-color-6', $warning-color);
+$warning-color-7: create-var('warning-color-7', genColor($warning-color, 7));
+$warning-color-8: create-var('warning-color-8', genColor($warning-color, 8));
+$warning-color-9: create-var('warning-color-9', genColor($warning-color, 9));
+$warning-color-10: create-var('warning-color-10', genColor($warning-color, 10));
+
+$success-color-1: create-var('success-color-1', genColor($success-color, 1)); // 浅色/白底悬浮
+$success-color-2: create-var('success-color-2', genColor($success-color, 2)); // 文字禁用
+$success-color-3: create-var('success-color-3', genColor($success-color, 3)); // 一般禁用
+$success-color-4: create-var('success-color-4', genColor($success-color, 4)); // 特殊场景
+$success-color-5: create-var('success-color-5', genColor($success-color, 5)); // 悬浮
+$success-color-6: create-var('success-color-6', $success-color); // 常规
+$success-color-7: create-var('success-color-7', genColor($success-color, 7)); // 点击
+$success-color-8: create-var('success-color-8', genColor($success-color, 8));
+$success-color-9: create-var('success-color-9', genColor($success-color, 9));
+$success-color-10: create-var('success-color-10', genColor($success-color, 10));
+
+$white: create-var('white', #fff);
+$gray-1: create-var('gray-1', #f3f3f3);
+$gray-2: create-var('gray-2', #eeeeee);
+$gray-3: create-var('gray-3', #e7e7e7);
+$gray-4: create-var('gray-4', #dcdcdc);
+$gray-5: create-var('gray-5', #c5c5c5);
+$gray-6: create-var('gray-6', #a6a6a6);
+$gray-7: create-var('gray-7', #8b8b8b);
+$gray-8: create-var('gray-8', #777777);
+$gray-9: create-var('gray-9', #5e5e5e);
+$gray-10: create-var('gray-10', #4b4b4b);
+$gray-11: create-var('gray-11', #383838);
+$gray-12: create-var('gray-12', #2c2c2c);
+$gray-13: create-var('gray-13', #242424);
+$gray-14: create-var('gray-14', #181818);
+$black: create-var('black', #000);
+
+// $text-color-1: create-var('text-color-1', rgba(0,0,0,0.88)); //primary
+// $text-color-2: create-var('text-color-2', rgba(0,0,0,0.65)); //secondary
+// $text-color-3: create-var('text-color-3', rgba(0,0,0,0.45)); //placeholder
+// $text-color-4: create-var('text-color-4', rgba(0,0,0,0.25)); //disabled
+$text-color-1: create-var('text-color-1', #000000E0); // primary (rgba(0,0,0,0.88))
+$text-color-2: create-var('text-color-2', #000000A6); // secondary (rgba(0,0,0,0.65))
+$text-color-3: create-var('text-color-3', #00000073); // placeholder (rgba(0,0,0,0.45))
+$text-color-4: create-var('text-color-4', #00000040); // disabled (rgba(0,0,0,0.25))
+
+// 容器
+$bg-color-page: create-var('bg-color-page', $gray-1); // 整体背景色 布局
+$bg-color-container: create-var('bg-color-container', #fff); // 一级容器背景 组件
+$bg-color-elevated: create-var('bg-color-elevated', #fff); // 二级容器背景 浮层
+$bg-color-spotlight: create-var('bg-color-spotlight', rgba(0, 0, 0, 0.85)); // 引起注意的如 Tooltip
+$bg-color-mask: create-var('bg-color-mask', rgba(0, 0, 0, 0.45)); // 蒙层
+
+// 填充
+// $fill-1: create-var('fill-1', rgba(0, 0, 0, 0.15));
+// $fill-2: create-var('fill-2', rgba(0, 0, 0, 0.06));
+// $fill-3: create-var('fill-3', rgba(0, 0, 0, 0.04));
+// $fill-4: create-var('fill-4', rgba(0, 0, 0, 0.02));
+$fill-1: create-var('fill-1', #00000026); // rgba(0,0,0,0.15)
+$fill-2: create-var('fill-2', #0000000F); // rgba(0,0,0,0.06)
+$fill-3: create-var('fill-3', #0000000A); // rgba(0,0,0,0.04)
+$fill-4: create-var('fill-4', #00000005); // rgba(0,0,0,0.02)
+
+
+// 描边
+$border-color-1: create-var('border-color-1', $gray-2); // 浅色
+$border-color-2: create-var('border-color-2', $gray-3); // 一般
+$border-color-3: create-var('border-color-3', $gray-4); // 深/悬浮
+$border-color-4: create-var('border-color-4', $gray-6); // 重/按钮描边
+
+
+$alpha-disabled: create-var('alpha-disabled', 0.5);
+$alpha-pressed: create-var('alpha-pressed', 0.07);
+
+// 投影
+/* #ifndef UNI-APP-X && APP */
+$shadow-1: create-var(
+ shadow-1,
+ 0 1px 10px rgba(0, 0, 0, 0.05),
+ 0 4px 5px rgba(0, 0, 0, 0.08),
+ 0 2px 4px -1px rgba(0, 0, 0, 0.12)
+);
+
+$shadow-2: create-var(
+ 'shadow-2',
+ 0 1px 10px rgba(0, 0, 0, 0.05),
+ 0 4px 5px rgba(0, 0, 0, 0.08),
+ 0 2px 4px -1px rgba(0, 0, 0, 0.12)
+);
+$shadow-3: create-var(
+ shadow-3,
+ 0 6px 30px 5px rgba(0, 0, 0, 0.05),
+ 0 16px 24px 2px rgba(0, 0, 0, 0.04),
+ 0 8px 10px -5px rgba(0, 0, 0, 0.08)
+);
+
+/* #endif */
+/* #ifdef UNI-APP-X && APP */
+$shadow-1: create-var(
+ shadow-1,
+ 0 1px 10px rgba(0, 0, 0, 0.05)
+);
+$shadow-2: create-var(
+ 'shadow-2',
+ 0 1px 10px rgba(0, 0, 0, 0.05)
+);
+$shadow-3: create-var(
+ shadow-3,
+ /* #ifdef APP-HARMONY
+ 0 6px 30px 5px $gray-3
+ /* #endif */
+ /* #ifndef APP-HARMONY
+ 0 6px 30px 5px rgba(0, 0, 0, 0.05)
+ /* #endif */
+
+);
+/* #endif */
+$shadow-4: create-var(shadow-4, 0 2px 8px 0 rgba(0, 0, 0, .06));
+
+// 基础颜色的扩展 用于 聚焦 / 禁用 / 点击 等状态
+$primary-color-focus: create-var('primary-color-focus', $primary-color-1);// focus态,包括鼠标和键盘
+$primary-color-active: create-var('primary-color-active', $primary-color-8);// 点击态
+$primary-color-disabled: create-var('primary-color-disabled', $primary-color-3);
+$primary-color-light: create-var('primary-color-light', $primary-color-1); // 浅色的选中态
+$primary-color-light-active: create-var('primary-color-light-active', $primary-color-2); // 浅色的选中态
+
+$primary-color: create-var(primary-color, $primary-color);
+$error-color: create-var(error-color, $error-color);
+$warning-color: create-var(warning-color, $warning-color);
+$success-color: create-var(success-color, $success-color);
+$info-color: create-var(info-color, $info-color);
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/dark.uts b/uni_modules/lime-style/token/dark.uts
new file mode 100644
index 0000000..bb373af
--- /dev/null
+++ b/uni_modules/lime-style/token/dark.uts
@@ -0,0 +1,67 @@
+import { TinyColor, generate, LGenerateOptions } from '@/uni_modules/lime-color';
+import { getAlphaColor, getSolidColor, generateColorPalettes } from './shared'
+import { SeedToken } from './interface'
+// #ifndef UNI-APP-X
+export type UTSJSONObject = Record
+const UTSJSONObject = Object
+// #endif
+
+export function generateNeutralColorPalettes(
+ bgBaseColor : string | null,
+ textBaseColor : string | null) : UTSJSONObject {
+ const colorBgBase = bgBaseColor ?? '#000';
+ const colorTextBase = textBaseColor ?? '#fff';
+
+ return {
+ 'bgColorBase': colorBgBase,
+ 'textColorBase': colorTextBase,
+
+ 'textColor1': getAlphaColor(colorTextBase, 0.85),
+ 'textColor2': getAlphaColor(colorTextBase, 0.65),
+ 'textColor3': getAlphaColor(colorTextBase, 0.45),
+ 'textColor4': getAlphaColor(colorTextBase, 0.25),
+
+ 'fill1': getAlphaColor(colorTextBase, 0.18),
+ 'fill2': getAlphaColor(colorTextBase, 0.12),
+ 'fill3': getAlphaColor(colorTextBase, 0.08),
+ 'fill4': getAlphaColor(colorTextBase, 0.04),
+
+ 'bgColorElevated': getSolidColor(colorBgBase, 12),
+ 'bgColorContainer': getSolidColor(colorBgBase, 8),
+ 'bgColorPage': getSolidColor(colorBgBase, 0),
+ 'bgColorSpotlight': getSolidColor(colorBgBase, 26),
+ // 'bgColor5': getAlphaColor(colorTextBase, 0.04),
+ 'bgColorMask': getAlphaColor(colorBgBase, 0.45),
+ 'bgColorBlur': getAlphaColor(colorTextBase, 0.04),
+
+ 'borderColor1': getSolidColor(colorBgBase, 26),
+ 'borderColor2': getSolidColor(colorBgBase, 19)
+ }
+}
+
+
+export function genColorMapToken(token : SeedToken) : UTSJSONObject {
+ const colorPrimaryBase = token.primaryColor
+ const colorSuccessBase = token.successColor
+ const colorWarningBase = token.warningColor
+ const colorErrorBase = token.errorColor
+ const colorInfoBase = token.infoColor
+ const colorBgBase = token.bgColorBase
+ const colorTextBase = token.textColorBase
+
+ const primaryColors = generateColorPalettes(colorPrimaryBase, 'primaryColor', 'dark');
+ const successColors = generateColorPalettes(colorSuccessBase, 'successColor', 'dark');
+ const warningColors = generateColorPalettes(colorWarningBase, 'warningColor', 'dark');
+ const errorColors = generateColorPalettes(colorErrorBase, 'errorColor', 'dark');
+ const infoColors = generateColorPalettes(colorInfoBase, 'infoColor', 'dark');
+ const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
+
+ return UTSJSONObject.assign(
+ {},
+ primaryColors,
+ successColors,
+ warningColors,
+ errorColors,
+ infoColors,
+ neutralColors)
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/genFontMapToken.uts b/uni_modules/lime-style/token/genFontMapToken.uts
new file mode 100644
index 0000000..ccd7256
--- /dev/null
+++ b/uni_modules/lime-style/token/genFontMapToken.uts
@@ -0,0 +1,49 @@
+// import type { FontMapToken } from '../../interface';
+import { getFontSizes } from './genFontSizes';
+
+export const genFontMapToken = (fontSize : number | null) : UTSJSONObject => {
+ if (fontSize == null) return {}
+ const fontSizePairs = getFontSizes(fontSize);
+ const fontSizes = fontSizePairs.map((pair) : number => pair.size);
+ const lineHeights = fontSizePairs.map((pair) : number => pair.lineHeight);
+
+ const fontSizeXS = fontSizes[0];
+ const fontSizeSM = fontSizes[1];
+ const fontSizeMD = fontSizes[3];
+ const fontSizeLG = fontSizes[4];
+
+ const lineHeight = lineHeights[2];
+ const lineHeightSM = lineHeights[1];
+ const lineHeightMD = lineHeights[3];
+ const lineHeightLG = lineHeights[4];
+
+ return {
+ fontSize,
+ fontSizeXS,
+ fontSizeSM,
+ fontSizeMD,
+ fontSizeLG,
+ fontSizeXL: fontSizes[5],
+
+ fontSizeHeading1: fontSizes[7],
+ fontSizeHeading2: fontSizes[6],
+ fontSizeHeading3: fontSizes[5],
+ fontSizeHeading4: fontSizes[4],
+ fontSizeHeading5: fontSizes[3],
+
+ lineHeight,
+ lineHeightLG,
+ lineHeightMD,
+ lineHeightSM,
+
+ fontHeight: Math.round(lineHeight * fontSizeMD),
+ fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
+ fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
+
+ lineHeightHeading1: lineHeights[7],
+ lineHeightHeading2: lineHeights[6],
+ lineHeightHeading3: lineHeights[5],
+ lineHeightHeading4: lineHeights[4],
+ lineHeightHeading5: lineHeights[3],
+ };
+};
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/genFontSizes.uts b/uni_modules/lime-style/token/genFontSizes.uts
new file mode 100644
index 0000000..c294b54
--- /dev/null
+++ b/uni_modules/lime-style/token/genFontSizes.uts
@@ -0,0 +1,30 @@
+import { FontSize } from './interface';
+
+export function getLineHeight(fontSize : number) : number {
+ return (fontSize + 8) / fontSize;
+}
+
+// https://zhuanlan.zhihu.com/p/32746810
+export function getFontSizes(base : number) : FontSize[] {
+ const length = 11 // 10
+ const offset = 2 // 1
+ // #ifdef APP-ANDROID
+ const arr = Array.fromNative(new IntArray(length.toInt()));
+ // #endif
+ // #ifndef APP-ANDROID
+ const arr = Array.from({ length });
+ // #endif
+ const fontSizes = arr.map((_, index) : number => {
+ const i = index - offset;
+ const baseSize = base * Math.pow(Math.E, i / 5);
+ const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
+
+ // Convert to even
+ return Math.floor(intSize / 2) * 2;
+ });
+ fontSizes[offset] = base;
+ return fontSizes.map((size) : FontSize => ({
+ size,
+ lineHeight: getLineHeight(size),
+ } as FontSize));
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/genRadius.uts b/uni_modules/lime-style/token/genRadius.uts
new file mode 100644
index 0000000..f4378d1
--- /dev/null
+++ b/uni_modules/lime-style/token/genRadius.uts
@@ -0,0 +1,63 @@
+export function genRadius(radiusBase : number):Map {
+ let radiusXL = radiusBase;
+ let radiusLG = radiusBase;
+ let radiusMD = radiusBase;
+ let radiusSM = radiusBase;
+ let radiusXS = radiusBase;
+ let radiusOuter = radiusBase;
+
+
+ // radiusSM = radiusBase - 3
+ // radiusXS = radiusSM - 1
+ // radiusLG = radiusBase + 3
+ // radiusXL = radiusLG + 3
+
+
+ // radiusXL
+ if (radiusBase < 6 && radiusBase >= 5) {
+ radiusXL = radiusBase + 3;
+ } else if (radiusBase < 16 && radiusBase >= 6) {
+ radiusXL = radiusBase + 6;
+ } else if (radiusBase >= 16) {
+ radiusXL = 16;
+ }
+
+ // radiusLG
+ if (radiusBase < 6 && radiusBase >= 5) {
+ radiusLG = radiusBase + 1;
+ } else if (radiusBase < 16 && radiusBase >= 6) {
+ radiusLG = radiusBase + 3;
+ } else if (radiusBase >= 16) {
+ radiusLG = 16;
+ }
+
+ // radiusSM
+ if (radiusBase < 7 && radiusBase >= 5) {
+ radiusSM = 3;
+ } else if (radiusBase < 8 && radiusBase >= 7) {
+ radiusSM = 4;
+ } else if (radiusBase < 14 && radiusBase >= 8) {
+ radiusSM = 5;
+ } else if (radiusBase < 16 && radiusBase >= 14) {
+ radiusSM = 6;
+ } else if (radiusBase >= 16) {
+ radiusSM = 8;
+ }
+
+ // radiusXS
+ if (radiusBase < 6 && radiusBase >= 2) {
+ radiusXS = 1;
+ } else if (radiusBase >= 6) {
+ radiusXS = 2;
+ }
+
+
+ return new Map([
+ ['borderRadius', radiusBase],
+ ['borderRadiusXS', radiusXS],
+ ['borderRadiusSM', radiusSM],
+ ['borderRadiusMD', radiusMD],
+ ['borderRadiusLG', radiusLG],
+ ['borderRadiusXL', radiusXL],
+ ])
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/genSizeMapToken.uts b/uni_modules/lime-style/token/genSizeMapToken.uts
new file mode 100644
index 0000000..f7832ab
--- /dev/null
+++ b/uni_modules/lime-style/token/genSizeMapToken.uts
@@ -0,0 +1,20 @@
+// import {SizeMapToken} from './interface'
+
+/**
+ * sizeUnit 尺寸变化单位
+ * sizeStep 尺寸步长
+ */
+export function genSizeMapToken(sizeUnit : number | null = 4, sizeStep : number | null = 4) : UTSJSONObject {
+ if (sizeUnit == null || sizeStep == null) return {}
+ return {
+ spacerHG: sizeUnit * (sizeStep + 16), // 80
+ spacerXL: sizeUnit * (sizeStep + 8), // 48
+ spacerLG: sizeUnit * (sizeStep + 4), // 32
+ spacerMD: sizeUnit * (sizeStep + 2), // 24
+ spacerMS: sizeUnit * sizeStep, // 16
+ spacer: sizeUnit * sizeStep, // 16
+ spacerSM: sizeUnit * (sizeStep - 1), // 12
+ spacerXS: sizeUnit * (sizeStep - 2), // 8
+ spacerTN: sizeUnit * (sizeStep - 3), // 4
+ };
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/interface.uts b/uni_modules/lime-style/token/interface.uts
new file mode 100644
index 0000000..9f93daf
--- /dev/null
+++ b/uni_modules/lime-style/token/interface.uts
@@ -0,0 +1,184 @@
+
+export type SeedToken = {
+ // ---------- Color ---------- //
+ /**
+ * @nameZH 是否生成深色色板
+ * @nameEN GenerateDarkPalette
+ * @desc 是否生成一套完整的深色阶梯色板,以支持深色模式的应用
+ * @descEN Whether to generate a complete set of dark color palettes to support dark mode applications
+ */
+ useDark ?: boolean;
+
+ /**
+ * @nameZH 品牌主色
+ * @nameEN Brand Color
+ * @desc 品牌色是体现产品特性和传播理念最直观的视觉元素之一。在你完成品牌主色的选取之后,我们会自动帮你生成一套完整的色板,并赋予它们有效的设计语义
+ * @descEN Brand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.
+ */
+ primaryColor ?: string;
+ /**
+ * @nameZH 成功色
+ * @nameEN Success Color
+ * @desc 用于表示操作成功的 Token 序列,如 Result、Progress 等组件会使用该组梯度变量。
+ * @descEN Used to represent the token sequence of operation success, such as Result, Progress and other components will use these map tokens.
+ */
+ successColor ?: string;
+
+ /**
+ * @nameZH 警戒色
+ * @nameEN Warning Color
+ * @desc 用于表示操作警告的 Token 序列,如 Notification、 Alert等警告类组件或 Input 输入类等组件会使用该组梯度变量。
+ * @descEN Used to represent the warning map token, such as Notification, Alert, etc. Alert or Control component(like Input) will use these map tokens.
+ */
+ warningColor ?: string;
+ /**
+ * @nameZH 错误色
+ * @nameEN Error Color
+ * @desc 用于表示操作失败的 Token 序列,如失败按钮、错误状态提示(Result)组件等。
+ * @descEN Used to represent the visual elements of the operation failure, such as the error Button, error Result component, etc.
+ */
+ errorColor ?: string;
+ /**
+ * @nameZH 信息色
+ * @nameEN Info Color
+ * @desc 用于表示操作信息的 Token 序列,如 Alert 、Tag、 Progress 等组件都有用到该组梯度变量。
+ * @descEN Used to represent the operation information of the Token sequence, such as Alert, Tag, Progress, and other components use these map tokens.
+ */
+ infoColor ?: string;
+ /**
+ * @nameZH 基础文本色
+ * @nameEN Seed Text Color
+ * @desc 用于派生文本色梯度的基础变量,v5 中我们添加了一层文本色的派生算法可以产出梯度明确的文本色的梯度变量。但请不要在代码中直接使用该 Seed Token !
+ * @descEN Used to derive the base variable of the text color gradient. In v5, we added a layer of text color derivation algorithm to produce gradient variables of text color gradient. But please do not use this Seed Token directly in the code!
+ */
+ textColorBase ?: string;
+
+ /**
+ * @nameZH 基础背景色
+ * @nameEN Seed Background Color
+ * @desc 用于派生背景色梯度的基础变量,v5 中我们添加了一层背景色的派生算法可以产出梯度明确的背景色的梯度变量。但请不要在代码中直接使用该 Seed Token !
+ * @descEN Used to derive the base variable of the background color gradient. In v5, we added a layer of background color derivation algorithm to produce map token of background color. But PLEASE DO NOT USE this Seed Token directly in the code!
+ */
+ bgColorBase ?: string;
+
+ /**
+ * @nameZH 超链接颜色
+ * @nameEN Hyperlink color
+ * @desc 控制超链接的颜色。
+ * @descEN Control the color of hyperlink.
+ */
+ linkColor ?: string;
+
+ // ---------- Font ---------- //
+
+ /**
+ * @nameZH 字体
+ * @nameEN Font family for default text
+ * @desc Lime Ui 的字体家族中优先使用系统默认的界面字体,同时提供了一套利于屏显的备用字体库,来维护在不同平台以及浏览器的显示下,字体始终保持良好的易读性和可读性,体现了友好、稳定和专业的特性。
+ * @descEN The font family of Lime Ui prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.
+ */
+ fontFamily ?: string;
+
+ /**
+ * @nameZH 代码字体
+ * @nameEN Font family for code text
+ * @desc 代码字体,用于 Typography 内的 code、pre 和 kbd 类型的元素
+ * @descEN Code font, used for code, pre and kbd elements in Typography
+ */
+ fontFamilyCode ?: string;
+
+ /**
+ * @nameZH 默认字号
+ * @nameEN Default Font Size
+ * @desc 设计系统中使用最广泛的字体大小,文本梯度也将基于该字号进行派生。
+ * @descEN The most widely used font size in the design system, from which the text gradient will be derived.
+ * @default 14
+ */
+ fontSize ?: number;
+
+
+ // ---------- BorderRadius ---------- //
+
+ /**
+ * @nameZH 基础圆角
+ * @nameEN Base Border Radius
+ * @descEN Border radius of base components
+ * @desc 基础组件的圆角大小,例如按钮、输入框、卡片等
+ */
+ borderRadius ?: number;
+
+ // ---------- Size ---------- //
+
+ /**
+ * @nameZH 尺寸变化单位
+ * @nameEN Size Change Unit
+ * @desc 用于控制组件尺寸的变化单位,在 Lime Ui 中我们的基础单位为 4 ,便于更加细致地控制尺寸梯度
+ * @descEN The unit of size change, in Lime Ui, our base unit is 4, which is more fine-grained control of the size step
+ * @default 4
+ */
+ sizeUnit ?: number;
+
+ /**
+ * @nameZH 尺寸步长
+ * @nameEN Size Base Step
+ * @desc 用于控制组件尺寸的基础步长,尺寸步长结合尺寸变化单位,就可以派生各种尺寸梯度。通过调整步长即可得到不同的布局模式,例如 V5 紧凑模式下的尺寸步长为 2
+ * @descEN The base step of size change, the size step combined with the size change unit, can derive various size steps. By adjusting the step, you can get different layout modes, such as the size step of the compact mode of V5 is 2
+ * @default 4
+ */
+ sizeStep ?: number;
+}
+export type FontSize = {
+ size : number
+ lineHeight : number
+}
+export type SizeMapToken = {
+ /**
+ * @nameZH Huge
+ * @default 80
+ */
+ sizeHG : number;
+ /**
+ * @nameZH XL
+ * @default 48
+ */
+ sizeXL : number;
+ /**
+ * @nameZH LG
+ * @default 32
+ */
+ sizeLG : number;
+ /**
+ * @nameZH MD
+ * @default 24
+ */
+ sizeMD : number;
+ /** Same as size by default, but could be larger in compact mode */
+ sizeMS : number;
+ /**
+ * @nameZH 默认
+ * @desc 默认尺寸
+ * @default 16
+ */
+ size : number;
+ /**
+ * @nameZH SM
+ * @default 12
+ */
+ sizeSM : number;
+ /**
+ * @nameZH XS
+ * @default 8
+ */
+ sizeXS : number;
+ /**
+ * @nameZH Tiny
+ * @default 4
+ */
+ sizeTN : number;
+}
+
+
+// #ifndef UNI-APP-X
+export type VueApp = any
+export type UTSJSONObject = Record
+// #endif
diff --git a/uni_modules/lime-style/token/light.uts b/uni_modules/lime-style/token/light.uts
new file mode 100644
index 0000000..8e3155a
--- /dev/null
+++ b/uni_modules/lime-style/token/light.uts
@@ -0,0 +1,66 @@
+import { TinyColor, generate } from '@/uni_modules/lime-color';
+import { getAlphaColor, getSolidColor, generateColorPalettes } from './shared'
+import { SeedToken } from './interface'
+// #ifndef UNI-APP-X
+export type UTSJSONObject = Record
+const UTSJSONObject = Object
+// #endif
+
+export function generateNeutralColorPalettes(
+ bgBaseColor : string | null,
+ textBaseColor : string | null
+) : UTSJSONObject {
+ const colorBgBase = bgBaseColor ?? '#fff';
+ const colorTextBase = textBaseColor ?? '#000';
+
+ return {
+ 'bgColorBase': bgBaseColor,
+ 'textColorBase': textBaseColor,
+
+ 'textColor1': getAlphaColor(colorTextBase, 0.88),
+ 'textColor2': getAlphaColor(colorTextBase, 0.65),
+ 'textColor3': getAlphaColor(colorTextBase, 0.45),
+ 'textColor4': getAlphaColor(colorTextBase, 0.25),
+
+ 'fill1': getAlphaColor(colorTextBase, 0.15),
+ 'fill2': getAlphaColor(colorTextBase, 0.06),
+ 'fill3': getAlphaColor(colorTextBase, 0.04),
+ 'fill4': getAlphaColor(colorTextBase, 0.02),
+
+ 'bgColorPage': getSolidColor(colorBgBase, 4),
+ 'bgColorContainer': getSolidColor(colorBgBase, 0),
+ 'bgColorElevated': getSolidColor(colorBgBase, 0),
+ 'bgColorMask': getAlphaColor(colorTextBase, 0.45),
+ 'bgColorSpotlight': getAlphaColor(colorTextBase, 0.85),
+ 'bgColorBlur': 'transparent',
+
+ 'borderColor1': getSolidColor(colorBgBase, 15),
+ 'borderColor2': getSolidColor(colorBgBase, 6)
+ }
+};
+
+export function genColorMapToken(token : SeedToken) : UTSJSONObject {
+ const colorPrimaryBase = token.primaryColor
+ const colorSuccessBase = token.successColor
+ const colorWarningBase = token.warningColor
+ const colorErrorBase = token.errorColor
+ const colorInfoBase = token.infoColor
+ const colorBgBase = token.bgColorBase
+ const colorTextBase = token.textColorBase
+
+ const primaryColors = generateColorPalettes(colorPrimaryBase, 'primaryColor');
+ const successColors = generateColorPalettes(colorSuccessBase, 'successColor');
+ const warningColors = generateColorPalettes(colorWarningBase, 'warningColor');
+ const errorColors = generateColorPalettes(colorErrorBase, 'errorColor');
+ const infoColors = generateColorPalettes(colorInfoBase, 'infoColor');
+ const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
+
+ return UTSJSONObject.assign(
+ {},
+ primaryColors,
+ successColors,
+ warningColors,
+ errorColors,
+ infoColors,
+ neutralColors)
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/shared.uts b/uni_modules/lime-style/token/shared.uts
new file mode 100644
index 0000000..45ed035
--- /dev/null
+++ b/uni_modules/lime-style/token/shared.uts
@@ -0,0 +1,24 @@
+import { TinyColor, generate } from '@/uni_modules/lime-color';
+import { LGenerateOptions } from '@/uni_modules/lime-color/utssdk/interface';
+
+export const getAlphaColor = (baseColor : string, alpha : number) : string =>
+ new TinyColor(baseColor).setAlpha(alpha).toRgbString();
+
+export const getSolidColor = (baseColor : string, brightness : number) : string => {
+ const instance = new TinyColor(baseColor);
+ return instance.lighten(brightness).toHexString();
+};
+
+export function generateColorPalettes(baseColor : string | null, name : string, theme: string = 'default') : UTSJSONObject {
+ if (baseColor == null) return {}
+ const colors = generate(baseColor, { theme } as LGenerateOptions);
+ const colorPalettes = colors.reduce((prev:UTSJSONObject, color:string, index:number) : UTSJSONObject => {
+ prev[`${name}${index + 1}`] = color;
+ return prev
+ }, {})
+
+ // 默认为中间色
+ colorPalettes[name] = colorPalettes[`${name}${6}`]
+ return colorPalettes
+}
+
diff --git a/uni_modules/lime-style/token/useThemeMode.uts b/uni_modules/lime-style/token/useThemeMode.uts
new file mode 100644
index 0000000..ffd9de4
--- /dev/null
+++ b/uni_modules/lime-style/token/useThemeMode.uts
@@ -0,0 +1,126 @@
+// @ts-nocheck
+// #ifndef UNI-APP-X
+import { type ComputedRef, ref, watch, getCurrentScope, onScopeDispose, computed, reactive } from './vue';
+// #endif
+
+type ThemeMode = 'light' | 'dark' | 'auto'
+const THEME_LOCAL_STORAGE_KEY = 'app-theme-preference'
+
+let limeThemeId = -1
+const limeThemeMode = ref('auto')
+const limeTheme = ref(getTheme())
+
+
+function setWeb (theme: ThemeMode) {
+ // #ifdef WEB
+ const pageHead = document.querySelector(".uni-page-head");
+ if(!pageHead) return
+ if (theme == 'dark') {
+ pageHead.style.backgroundColor = '#181818'
+ pageHead.style.color = ''
+ } else {
+ pageHead.style.backgroundColor = 'rgb(245, 245, 245)'
+ pageHead.style.color = 'rgb(0, 0, 0)'
+ }
+ // #endif
+}
+
+
+export function getTheme(): 'dark' | 'light' {
+ // #ifndef UNI-APP-X && APP
+ let mode = uni.getStorageSync(THEME_LOCAL_STORAGE_KEY)
+ limeThemeMode.value = (mode || 'auto')
+ const hostTheme = uni.getAppBaseInfo().hostTheme;
+ return limeThemeMode.value === 'auto' ? (hostTheme || 'light') : limeThemeMode.value
+ // #endif
+
+ // #ifdef UNI-APP-X && APP
+ let { osTheme, appTheme } = uni.getSystemInfoSync();
+ return appTheme == "auto" ? osTheme! : appTheme!
+ // #endif
+
+
+}
+
+// #ifndef UNI-APP-X
+let limeThemeCallBack = (result) => {
+ limeTheme.value = result.theme
+};
+// #endif
+
+export function stop() {
+ // #ifndef UNI-APP-X
+ uni.offThemeChange(limeThemeCallBack)
+ // #endif
+ // #ifdef UNI-APP-X
+ // #ifndef UNI-APP-X && APP
+ uni.offHostThemeChange(limeThemeId)
+
+ // #endif
+ // #ifdef UNI-APP-X && APP
+ uni.offAppThemeChange(limeThemeId)
+ // #endif
+ // #endif
+}
+
+
+// 检查系统主题
+export const checkSystemTheme = () => {
+ stop()
+ limeTheme.value = getTheme()
+ // #ifndef UNI-APP-X
+ uni.onThemeChange(limeThemeCallBack);
+ // #endif
+ // #ifdef UNI-APP-X
+ // #ifndef UNI-APP-X && APP
+ limeThemeId = uni.onHostThemeChange((result) => {
+ limeTheme.value = result.hostTheme
+ });
+ // #endif
+ // #ifdef UNI-APP-X && APP
+ limeThemeId = uni.onAppThemeChange((res : AppThemeChangeResult) => {
+ limeTheme.value = res.appTheme.trim()
+ })
+ // #endif
+ // #endif
+}
+
+
+export const isDarkMode = computed(() => {
+ return limeTheme.value == "dark";
+});
+
+export function setThemeMode(theme: 'dark' | 'light' | 'auto') {
+ // #ifdef UNI-APP-X && APP
+ if (limeTheme.value == theme) return;
+ uni.setAppTheme({
+ theme,
+ success: function (result: SetAppThemeSuccessResult) {
+ console.log("设置appTheme为"+ result.theme +"成功")
+ limeTheme.value = result.theme
+ },
+ fail: function (e : IAppThemeFail) {
+ console.log("设置appTheme为 auto 失败,原因:", e.errMsg)
+ }
+ })
+ // #endif
+ // #ifndef UNI-APP-X && APP
+ limeThemeMode.value = theme
+ uni.setStorageSync(THEME_LOCAL_STORAGE_KEY, theme)
+ limeTheme.value = getTheme()
+ // #endif
+ // #ifdef WEB
+ setWeb(limeTheme.value )
+ // #endif
+}
+
+
+export function toggleTheme() {
+ setThemeMode(isDarkMode.value ? 'light' : 'dark')
+}
+
+// #ifdef WEB
+watch(isDarkMode, ()=>{
+ setWeb(limeTheme.value)
+})
+// #endif
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/useThemeVars.uts b/uni_modules/lime-style/token/useThemeVars.uts
new file mode 100644
index 0000000..d5ceb23
--- /dev/null
+++ b/uni_modules/lime-style/token/useThemeVars.uts
@@ -0,0 +1,123 @@
+// @ts-nocheck
+import { isDarkMode } from './useThemeMode'
+import type { SeedToken } from './interface';
+import { genFontMapToken } from './genFontMapToken';
+import { genSizeMapToken } from './genSizeMapToken';
+import { genColorMapToken as genLightColorMapToken } from './light';
+import { genColorMapToken as genDarkColorMapToken } from './dark';
+import { computed, reactive } from 'vue'; // 或相应的响应式系统
+
+
+
+// #ifndef UNI-APP-X
+export type VueApp = any
+export type UTSJSONObject = Record
+const UTSJSONObject = Object
+// #endif
+
+
+// 内部存储的 tokens
+type LimeTokens = {
+ light : UTSJSONObject
+ dark : UTSJSONObject
+}
+
+// 默认的基础 token
+const DEFAULT_SEED_TOKEN : SeedToken = {
+ primaryColor: '#3283ff'
+};
+
+export const themeTokenMaps = reactive({
+ light: {},
+ dark: {},
+})
+
+
+// 初始化默认 tokens
+function initDefaultTokens() {
+ // Light 主题颜色
+ const lightColors = {
+ white: '#fff',
+ gray1: '#f3f3f3',
+ gray2: '#eeeeee',
+ gray3: '#e7e7e7',
+ gray4: '#dcdcdc',
+ gray5: '#c5c5c5',
+ gray6: '#a6a6a6',
+ gray7: '#8b8b8b',
+ gray8: '#777777',
+ gray9: '#5e5e5e',
+ gray10: '#4b4b4b',
+ gray11: '#383838',
+ gray12: '#2c2c2c',
+ gray13: '#242424',
+ gray14: '#181818',
+ black: '#000',
+ ...genLightColorMapToken(DEFAULT_SEED_TOKEN)
+ };
+ // Dark 主题颜色
+ const darkColors = {
+ white: '#000', // 在暗黑模式下反转
+ gray1: '#181818',
+ gray2: '#242424',
+ gray3: '#2c2c2c',
+ gray4: '#383838',
+ gray5: '#4b4b4b',
+ gray6: '#5e5e5e',
+ gray7: '#777777',
+ gray8: '#8b8b8b',
+ gray9: '#a6a6a6',
+ gray10: '#c5c5c5',
+ gray11: '#dcdcdc',
+ gray12: '#e7e7e7',
+ gray13: '#eeeeee',
+ gray14: '#f3f3f3',
+ black: '#fff', // 在暗黑模式下反转
+ ...genDarkColorMapToken(DEFAULT_SEED_TOKEN)
+ };
+
+ themeTokenMaps.light = UTSJSONObject.assign({}, lightColors, lightColors)
+ themeTokenMaps.dark = UTSJSONObject.assign({}, darkColors, darkColors)
+}
+
+initDefaultTokens();
+
+// 导出的 themeTokens 是计算属性,自动返回当前主题的 tokens
+export const themeTokens = computed(():UTSJSONObject => {
+ return isDarkMode.value ? themeTokenMaps.dark : themeTokenMaps.light;
+});
+
+
+
+export function useThemeToken(token : SeedToken | null = null) {
+ if (token != null) {
+ const lightColors = genLightColorMapToken(token!);
+ const darkColors = genDarkColorMapToken(token!);
+
+ // 只有在提供了相关属性时才重新生成 fonts 和 sizes
+ const fonts = genFontMapToken(token!.fontSize)
+ const sizes = genSizeMapToken(token!.sizeUnit, token.sizeStep)
+
+ themeTokenMaps.light = UTSJSONObject.assign({}, themeTokenMaps.light, lightColors, fonts, sizes)
+ themeTokenMaps.dark = UTSJSONObject.assign({}, themeTokenMaps.dark, darkColors, fonts, sizes)
+ }
+}
+
+export function useThemeVars(options : UTSJSONObject | null = null) {
+ if (options != null) {
+ const currentTheme = isDarkMode.value ? themeTokenMaps.dark : themeTokenMaps.light;
+
+ // #ifdef UNI-APP-X && APP
+ options.toMap().forEach((value, key) => {
+ currentTheme.set(key, value);
+ });
+ // #endif
+
+ // #ifndef UNI-APP-X && APP
+ Object.entries(options).forEach(([key, value]) => {
+ // currentTheme.set(key, value);
+ currentTheme[key] = value
+ });
+ // #endif
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/lime-style/token/vue.ts b/uni_modules/lime-style/token/vue.ts
new file mode 100644
index 0000000..d8ded83
--- /dev/null
+++ b/uni_modules/lime-style/token/vue.ts
@@ -0,0 +1,13 @@
+// @ts-nocheck
+// #ifndef VUE3
+import Vue from 'vue'
+import VueCompositionAPI from '@vue/composition-api'
+Vue.use(VueCompositionAPI)
+export * from '@vue/composition-api'
+// #endif
+// #ifdef VUE3
+export * from 'vue';
+// #endif
+// #ifdef APP-IOS || APP-ANDROID
+export type ComputedRef = ComputedRefImpl
+// #endif
\ No newline at end of file
diff --git a/uni_modules/lime-style/var.scss b/uni_modules/lime-style/var.scss
new file mode 100644
index 0000000..3b107f8
--- /dev/null
+++ b/uni_modules/lime-style/var.scss
@@ -0,0 +1,64 @@
+@import './mixins/create.scss';
+// 公共前缀
+$prefix: l !default;
+
+// Spacer
+$spacer: create-var('spacer', 16px) !default; // base
+$spacer-tn: create-var('spacer-tn', 4px) !default; // Tiny
+$spacer-xs: create-var('spacer-xs', 8px) !default; // Extra Small
+$spacer-sm: create-var('spacer-sm', 12px) !default; // Small
+$spacer-md: create-var('spacer-md', 24px) !default; // Medium
+$spacer-lg: create-var('spacer-lg', 32px) !default; // Large
+$spacer-xl: create-var('spacer-xl', 48px) !default; // Extra Large
+$spacer-hg: create-var('spacer-hg', 80px) !default; // Huge //Ultra Big
+
+// Font 官方建议字体不跟随页面变化
+$font-size: create-var('font-size', 14px) !default;
+$font-size-xs: create-var('font-size-xs', 10px) !default;
+$font-size-sm: create-var('font-size-sm', 12px) !default;
+$font-size-md: create-var('font-size-md', 16px) !default;
+$font-size-lg: create-var('font-size-lg',20px) !default;
+$font-size-xl: create-var('font-size-xl', 36px) !default;
+
+$font-size-heading-1: create-var('font-size-heading-1', 38px) !default;
+$font-size-heading-2: create-var('font-size-heading-2', 30px) !default;
+$font-size-heading-3: create-var('font-size-heading-3', 24px) !default;
+$font-size-heading-4: create-var('font-size-heading-4', 20px) !default;
+$font-size-heading-5: create-var('font-size-heading-5', 16px) !default;
+
+
+$font-family: create-var('font-family', PingFang SC, Microsoft YaHei, Arial Regular) !default; // 字体-磅数-常规
+$font-family-md: create-var('font-family-md', PingFang SC, Microsoft YaHei, Arial Medium) !default; // 字体-磅数-粗体
+
+
+// 行高
+$line-height: create-var('line-height', 1.5714285714285714) !default;
+$line-height-sm: create-var('line-height-sm', 1.6666666666666667) !default;
+$line-height-md: create-var('line-height-lg', 1.5) !default;
+$line-height-lg: create-var('line-height-lg', 1.4) !default;
+
+$line-height-heading-1: create-var('line-height-heading-1', 1.2105263157894737) !default;
+$line-height-heading-2: create-var('line-height-heading-2', 1.2666666666666666) !default;
+$line-height-heading-3: create-var('line-height-heading-3', 1.3333333333333333) !default;
+$line-height-heading-4: create-var('line-height-heading-4', 1.4) !default;
+$line-height-heading-5: create-var('line-height-heading-5', 1.5) !default;
+
+
+// 圆角
+$border-radius: create-var('border-radius', 6px) !default;
+$border-radius-xs: create-var('border-radius-xs', 2px) !default;
+$border-radius-sm: create-var('border-radius-sm', 3px) !default;
+$border-radius-md: create-var('border-radius-md', 6px) !default;
+$border-radius-lg: create-var('border-radius-lg', 9px) !default;
+$border-radius-xl: create-var('border-radius-xl', 12px) !default;
+$border-radius-hg: create-var('border-radius-hg', 999px) !default;
+// $border-radius-circle: var(--l-border-radius-circle, 50%);
+
+
+// 动画
+$anim-time-fn-easing: create-var('anim-time-fn-easing', cubic-bezier(0.38, 0, 0.24, 1)) !default;
+$anim-time-fn-ease-out: create-var('anim-time-fn-ease-out', cubic-bezier(0, 0, 0.15, 1)) !default;
+$anim-time-fn-ease-in: create-var('anim-time-fn-ease-in', cubic-bezier(0.82, 0, 1, 0.9)) !default;
+$anim-duration-base: create-var('anim-duration-base', 0.2s) !default;
+$anim-duration-moderate: create-var('anim-duration-moderate', 0.24s) !default;
+$anim-duration-slow: create-var('anim-duration-slow', 0.28s) !default;
\ No newline at end of file
diff --git a/uni_modules/mp-html/README.md b/uni_modules/mp-html/README.md
index 9959952..cf9ba73 100644
--- a/uni_modules/mp-html/README.md
+++ b/uni_modules/mp-html/README.md
@@ -1,8 +1,4 @@
-## news
-1. 欢迎加入 `QQ` 交流群:`699734691`
- 
-2. 示例微信小程序 `富文本插件` 添加 `获取组件包` 功能 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart?id=mp)
- 
+## 为减小组件包的大小,默认组件包中不包含编辑、latex 公式等扩展功能,需要使用扩展功能的请参考下方的 插件扩展 栏的说明
## 功能介绍
- 全端支持(含 `v3、NVUE`)
@@ -11,10 +7,10 @@
- 支持设置占位图(加载中、出错时、预览时)
- 支持锚点跳转、长按复制等丰富功能
- 支持大部分 *html* 实体
-- 丰富的插件(关键词搜索、内容 **编辑** 等)
+- 丰富的插件(关键词搜索、内容编辑、`latex` 公式等)
- 效率高、容错性强且轻量化
-查看 [功能介绍](https://jin-yufeng.gitee.io/mp-html/#/overview/feature) 了解更多
+查看 [功能介绍](https://jin-yufeng.github.io/mp-html/#/overview/feature) 了解更多
## 使用方法
- `uni_modules` 方式
@@ -88,13 +84,13 @@
使用 *cli* 方式运行的项目,通过 *npm* 方式引入时,需要在 *vue.config.js* 中配置 *transpileDependencies*,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687)
如果在 **nvue** 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行
-查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多
+查看 [快速开始](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) 了解更多
## 组件属性
| 属性 | 类型 | 默认值 | 说明 |
|:---:|:---:|:---:|---|
-| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v210)) |
+| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v210)) |
| content | String | | 用于渲染的 html 字符串 |
| copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 |
| domain | String | | 主域名(用于链接拼接) |
@@ -110,7 +106,7 @@
| tag-style | Object | | 设置标签的默认样式 |
| use-anchor | Boolean | false | 是否使用锚点链接 |
-查看 [属性](https://jin-yufeng.gitee.io/mp-html/#/basic/prop) 了解更多
+查看 [属性](https://jin-yufeng.github.io/mp-html/#/basic/prop) 了解更多
## 组件事件
@@ -121,8 +117,9 @@
| error | 发生渲染错误时 |
| imgtap | 图片被点击时 |
| linktap | 链接被点击时 |
+| play | 音视频播放时 |
-查看 [事件](https://jin-yufeng.gitee.io/mp-html/#/basic/event) 了解更多
+查看 [事件](https://jin-yufeng.github.io/mp-html/#/basic/event) 了解更多
## api
组件实例上提供了一些 `api` 方法可供调用
@@ -135,8 +132,10 @@
| getRect | 获取富文本内容的位置和大小 |
| setContent | 设置富文本内容 |
| imgList | 获取所有图片的数组 |
+| pauseMedia | 暂停播放音视频([2.2.2+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v222)) |
+| setPlaybackRate | 设置音视频播放速率([2.4.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v240)) |
-查看 [api](https://jin-yufeng.gitee.io/mp-html/#/advanced/api) 了解更多
+查看 [api](https://jin-yufeng.github.io/mp-html/#/advanced/api) 了解更多
## 插件扩展
除基本功能外,本组件还提供了丰富的扩展,可按照需要选用
@@ -144,7 +143,7 @@
| 名称 | 作用 |
|:---:|---|
| audio | 音乐播放器 |
-| editable | 富文本 **编辑**([示例项目](https://6874-html-foe72-1259071903.tcb.qcloud.la/editable.zip?sign=cc0017be203fb3dbca62d33a0c15792e&t=1608447445)) |
+| editable | 富文本 **编辑**([示例项目](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip)) |
| emoji | 解析 emoji |
| highlight | 代码块高亮显示 |
| markdown | 渲染 markdown |
@@ -152,8 +151,9 @@
| style | 匹配 style 标签中的样式 |
| txv-video | 使用腾讯视频 |
| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) |
+| latex | 渲染 latex 公式 by [@Zeng-J](https://github.com/Zeng-J) |
-从插件市场导入的包中 **不含有** 扩展插件,需要使用插件参考以下方法:
+从插件市场导入的包中 **不含有** 扩展插件,使用插件需通过微信小程序 `富文本插件` 获取或参考以下方法进行打包:
1. 获取完整组件包
```bash
npm install mp-html
@@ -167,19 +167,26 @@
```
4. 拷贝 `dist/uni-app` 中的内容到项目根目录
-查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多
+查看 [插件](https://jin-yufeng.github.io/mp-html/#/advanced/plugin) 了解更多
## 关于 nvue
`nvue` 使用原生渲染,不支持部分 `css` 样式,为实现和 `html` 相同的效果,组件内部通过 `web-view` 进行渲染,性能上差于原生,根据 `weex` 官方建议,`web` 标签仅应用在非常规的降级场景。因此,如果通过原生的方式(如 `richtext`)能够满足需要,则不建议使用本组件,如果有较多的富文本内容,则可以直接使用 `vue` 页面
由于渲染方式与其他端不同,有以下限制:
1. 不支持 `lazy-load` 属性
2. 视频不支持全屏播放
+3. 如果在 `flex-direction: row` 的容器中使用,需要给组件设置宽度或设置 `flex: 1` 占满剩余宽度
纯 `nvue` 模式下,[此问题](https://ask.dcloud.net.cn/question/119678) 修复前,不支持通过 `uni_modules` 引入,需要本地引入(将 [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 中的内容拷贝到项目根目录下)
+
## 问题反馈
-遇到问题时,请先查阅 [常见问题](https://jin-yufeng.gitee.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题
+遇到问题时,请先查阅 [常见问题](https://jin-yufeng.github.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题
可通过 [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` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复
-查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多
\ No newline at end of file
+欢迎加入 `QQ` 交流群:
+群1(已满):`699734691`
+群2(已满):`778239129`
+群3:`960265313`
+
+查看 [问题反馈](https://jin-yufeng.github.io/mp-html/#/question/feedback) 了解更多
diff --git a/uni_modules/mp-html/changelog.md b/uni_modules/mp-html/changelog.md
index c370731..ebb557a 100644
--- a/uni_modules/mp-html/changelog.md
+++ b/uni_modules/mp-html/changelog.md
@@ -1,3 +1,71 @@
+## v2.5.1(2025-04-20)
+1. `U` 适配鸿蒙 `APP` [详细](https://github.com/jin-yufeng/mp-html/issues/615)
+2. `U` 微信小程序替换废弃 `api` `getSystemInfoSync` [详细](https://github.com/jin-yufeng/mp-html/issues/613)
+3. `F` 修复了 `app` 端播放视频可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/617)
+4. `F` 修复了 `latex` 插件可能出现 `xxx can be used only in display mode` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/632)
+5. `F` 修复了 `uni-app` 包 `latex` 公式可能不显示的问题 [#599](https://github.com/jin-yufeng/mp-html/issues/599)、[#627](https://github.com/jin-yufeng/mp-html/issues/627)
+## v2.5.0(2024-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.3(2024-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.2(2023-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.1(2022-12-25)
+1. `F` 修复了没有图片时 `ready` 事件可能不触发的问题
+2. `F` 修复了加载过程中可能出现 `Root label not found` 错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/470)
+3. `F` 修复了 `audio` 插件退出页面可能会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/457)
+4. `F` 修复了 `vue3` 运行到 `app` 在 `HBuilder X 3.6.10` 以上报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/480)
+5. `F` 修复了 `nvue` 端链接中包含 `%22` 时可能无法显示的问题
+6. `F` 修复了 `vue3` 使用 `highlight` 插件可能报错的问题
+## v2.4.0(2022-08-27)
+1. `A` 增加了 [setPlaybackRate](https://jin-yufeng.gitee.io/mp-html/#/advanced/api#setPlaybackRate) 的 `api`,可以设置音视频的播放速率 [详细](https://github.com/jin-yufeng/mp-html/issues/452)
+2. `A` 示例小程序代码开源 [详细](https://github.com/jin-yufeng/mp-html-demo)
+3. `U` 优化 `ready` 事件触发时机,未设置懒加载的情况下基本可以准确触发 [详细](https://github.com/jin-yufeng/mp-html/issues/195)
+4. `U` `highlight` 插件在编辑状态下不进行高亮处理,便于编辑
+5. `F` 修复了 `flex` 布局下图片大小可能不正确的问题
+6. `F` 修复了 `selectable` 属性没有设置 `force` 也可能出现渲染异常的问题
+7. `F` 修复了表格中的图片大小可能不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/448)
+8. `F` 修复了含有合并单元格的表格可能无法设置竖直对齐的问题
+9. `F` 修复了 `editable` 插件在 `scroll-view` 中使用时工具条位置可能不正确的问题
+10. `F` 修复了 `vue3` 使用 [search](advanced/plugin#search) 插件可能导致错误换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/449)
+## v2.3.2(2022-08-13)
+1. `A` 增加 [latex](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#latex) 插件,可以渲染数学公式 [详细](https://github.com/jin-yufeng/mp-html/pull/447) by [@Zeng-J](https://github.com/Zeng-J)
+2. `U` 优化根节点下有很多标签的长内容渲染速度
+3. `U` `highlight` 插件适配 `lang-xxx` 格式
+4. `F` 修复了 `table` 标签设置 `border` 属性后可能无法修改边框样式的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/439) by [@zouxingjie](https://github.com/zouxingjie)
+5. `F` 修复了 `editable` 插件输入连续空格无效的问题
+6. `F` 修复了 `vue3` 图片设置 `inline` 会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/438)
+7. `F` 修复了 `vue3` 使用 `table` 可能报错的问题
+## v2.3.1(2022-05-20)
+1. `U` `app` 端支持使用本地图片
+2. `U` 优化了微信小程序 `selectable` 属性在 `ios` 端的处理 [详细](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable)
+3. `F` 修复了 `editable` 插件不在顶部时 `tooltip` 位置可能错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/430)
+4. `F` 修复了 `vue3` 运行到微信小程序可能报错丢失内容的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/414)
+5. `F` 修复了 `vue3` 部分标签可能被错误换行的问题
+6. `F` 修复了 `editable` 插件 `app` 端插入视频无法预览的问题
## v2.3.0(2022-04-01)
1. `A` 增加了 `play` 事件,音视频播放时触发,可用于与页面其他音视频进行互斥播放 [详细](basic/event#play)
2. `U` `show-img-menu` 属性支持控制预览时是否长按弹出菜单
diff --git a/uni_modules/mp-html/components/mp-html/mp-html.vue b/uni_modules/mp-html/components/mp-html/mp-html.vue
index 24caed9..796762b 100644
--- a/uni_modules/mp-html/components/mp-html/mp-html.vue
+++ b/uni_modules/mp-html/components/mp-html/mp-html.vue
@@ -2,7 +2,7 @@
-
+
@@ -12,7 +12,7 @@
-
diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
index 912ba92..be5bb64 100644
--- a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
+++ b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue
@@ -75,7 +75,7 @@
*/
export default {
name: 'UniDataPicker',
- emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue'],
+ emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue','inputclick'],
mixins: [dataPicker],
components: {
DataPickerView
@@ -131,9 +131,16 @@
this.load();
})
},
+ watch: {
+ localdata: {
+ handler() {
+ this.load()
+ },
+ deep: true
+ },
+ },
methods: {
clear() {
- this.modelValue = null;
this._dispatchEvent([]);
},
onPropsChange() {
@@ -148,10 +155,6 @@
return;
}
- if (!this.hasValue) {
- // return;
- }
-
// 回显本地数据
if (this.isLocalData) {
this.loadData();
@@ -184,6 +187,7 @@
},
handleInput() {
if (this.readonly) {
+ this.$emit('inputclick')
return
}
this.show()
@@ -228,15 +232,24 @@
}
let result = []
- for (let i = 0; i < value.length; i++) {
- var val = value[i]
- var item = dataList.find((v) => {
- return v.value == val
- })
- if (item) {
- result.push(item)
- }
- }
+ if (Array.isArray(value)) {
+ for (let i = 0; i < value.length; i++) {
+ var val = value[i]
+ var item = dataList.find((v) => {
+ return v.value == val
+ })
+ if (item) {
+ result.push(item)
+ }
+ }
+ } else {
+ let item = dataList.find((v) => {
+ return v.value == value;
+ });
+ if (item) {
+ result.push(item);
+ }
+ }
if (result.length) {
this.inputSelected = result
}
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts b/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts
new file mode 100644
index 0000000..baa0dff
--- /dev/null
+++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts
@@ -0,0 +1 @@
+export const imgbase : string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzlBMzU3OTlEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzlBMzU3OUFEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOUEzNTc5N0Q5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOUEzNTc5OEQ5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pt+ALSwAAA6CSURBVHja1FsLkFZVHb98LM+F5bHL8khA1iSeiyQBCRM+YGqKUnnJTDLGI0BGZlKDIU2MMglUiDApEZvSsZnQtBRJtKwQNKQMFYeRDR10WOLd8ljYXdh+v8v5fR3Od+797t1dnOnO/Ofce77z+J//+b/P+ZqtXbs2sJ9MJhNUV1cHJ06cCJo3bx7EPc2aNcvpy7pWrVoF+/fvDyoqKoI2bdoE9fX1F7TjN8a+EXBn/fkfvw942Tf+wYMHg9mzZwfjxo0LDhw4EPa1x2MbFw/fOGfPng1qa2tzcCkILsLDydq2bRsunpOTMM7TD/W/tZDZhPdeKD+yGxHhdu3aBV27dg3OnDlzMVANMheLAO3btw8KCwuDmpoaX5OxbgUIMEq7K8IcPnw4KCsrC/r37x8cP378/4cAXAB3vqSkJMuiDhTkw+XcuXNhOWbMmKBly5YhUT8xArhyFvP0BfwRsAuwxJZJsm/nzp2DTp06he/OU+cZ64K6o0ePBkOHDg2GDx8e6gEbJ5Q/NHNuAJQ1hgBeHUDlR7nVTkY8rQAvAi4z34vR/mPs1FoRsaCgIJThI0eOBC1atEiFGGV+5MiRoS45efJkqFjJFXV1dQuA012m2WcwTw98fy6CqBdsaiIO4CScrGPHjvk4odhavPquRtFWXEC25VgkREKOCh/qDSq+vn37htzD/mZTOmOc5U7zKzBPEedygWshcDyWvs30igAbU+6oyMgJBCFhwQE0fccxN60Ay9iebbjoDh06hMowjQxT4fXq1SskArmHZpkArvixp/kWzHdMeArExSJEaiXIjjRjRJ4DaAGWpibLzXN3Fm1vA5teBgh3j1Rv3bp1YgKwPdmf2p9zcyNYYgPKMfY0T5f5nNYdw158nJ8QawW4CLKwiOBSEgO/hok2eBydR+3dYH+PLxA5J8Vv0KBBwenTp0P2JWAx6+yFEBfs8lMY+y0SWMBNI9E4ThKi58VKTg3FQZS1RQF1cz27eC0QHMu+3E0SkUowjhVt5VdaWhp07949ZHv2Qd1EjDXM2cla1M0nl3GxAs3J9yREzyTdFVKVFOaE9qRA8GM0WebRuo9JGZKA7Mv2SeS/Z8+eoQ9BArMfFrLGo6jvxbhHbJZnKX2Rzz1O7QhJJ9Cs2ZMaWIyq/zhdeqPNfIoHd58clIQD+JSXl4dKlyIAuBdVXZwFVWKspSSoxE++h8x4k3uCnEhE4I5KwRiFWGOU0QWKiCYLbdoRMRKAu2kQ9vkfLU6dOhX06NEjlH+yMRZSinnuyWnYosVcji8CEA/6Cg2JF+IIUBqnGKUTCNwtwBN4f89RiK1R96DEgO2o0NDmtEdvVFdVVYV+P3UAPUEs6GFwV3PHmXkD4vh74iDFJysVI/MlaQhwKeBNTLYX5VuA8T4/gZxA4MRGFxDB6R7OmYPfyykGRJbyie+XnGYnQIC/coH9+vULiYrxrkL9ZA9+0ykaHIfEpM7ge8TiJ2CsHYwyMfafAF1yCGBHYIbCVDjDjKt7BeB51D+LgQa6OkG7IDYEEtvQ7lnXLKLtLdLuJBpE4gPUXcW2+PkZwOex+4cGDhwYDBkyRL7/HFcEwUGPo/8uWRUpYnfxGHco8HkewLHLyYmAawAPuIFZxhOpDfJQ8gbUv41yORAptMWBNr6oqMhWird5+u+iHmBb2nhjDV7HWBNQTgK8y11l5NetWzc5ULscAtSj7nbNI0skhWeUZCc0W4nyH/jO4Vz0u1IeYhbk4AiwM6tjxIWByHsoZ9qcIBPJd/y+DwPfBESOmCa/QF3WiZHucLlEDpNxcNhmheEOPgdQNx6/VZFQzFZ5TN08AHXQt2Ii3EdyFuUsPtTcGPhW5iMiCNELvz+Gdn9huG4HUJaW/w3g0wxV0XaG7arG2WeKiUWYM4Y7GO5ezshTARbbWGw/DvXkpp/ivVvE0JVoMxN4rpGzJMhE5Pl+xlATsDIqikP9F9D2z3h9nOksEUFhK+qO4rcPkoalMQ/HqJLIyb3F3JdjrCcw1yZ8joyJLR5gCo54etlag7qIoeNh1N1BRYj3DTFJ0elotxPlVzkGuYAmL0VSJVGAJA41c4Z6A3BzTLfn0HYwYKEI6CUAMzZEWvLsIcQOo1AmmyyM72nHJCfYsogflGV6jEk9vyQZXSuq6w4c16NsGcGZbwOPr+H1RkOk2LEzjNepxQkihHSCQ4ynAYNRx2zMKV92CQMWqj8J0BRE8EShxRFN6YrfCRhC0x3r/Zm4IbQCcmJoV0kMamllccR6FjHqUC5F2R/wS2dcymOlfAKOS4KmzQb5cpNC2MC7JhVn5wjXoJ44rYhLh8n0eXOCorJxa7POjbSlCGVczr34/RsAmrcvo9s+wGp3tzVhntxiXiJ4nvEYb4FJkf0O8HocAePmLvCxnL0AORraVekJk6TYjDabRVXfRE2lCN1h6ZQRN1+InUbsCpKwoBZHh0dODN9JBCUffItXxEavTQkUtnfTVAplCWL3JISz29h4NjotnuSsQKJCk8dF+kJR6RARjrqFVmfPnj3ZbK8cIJ0msd6jgHPGtfVTQ8VLmlvh4mct9sobRmPic0DyDQQnx/NlfYUgyz59+oScsH379pAwXABD32nTpoUHIToESeI5mnbE/UqDdyLcafEBf2MCqgC7NwxIbMREJQ0g4D4sfJwnD+AmRrII05cfMWJE+L1169bQr+fip06dGp4oJ83lmYd5wj/EmMa4TaHivo4EeCguYZBnkB5g2aWA69OIEnUHOaGysjIYMGBAMGnSpODYsWPZwCpFmm4lNq+4gSLQA7jcX8DwtjEyRC8wjabnXEx9kfWnTJkSJkAo90xpJVV+FmcVNeYAF5zWngS4C4O91MBxmAv8blLEpbjI5sz9MTdAhcgkCT1RO8mZkAjfiYpTEvStAS53Uw1vAiUGgZ3GpuQEYvoiBqlIan7kSDHnTwJQFNiPu0+5VxCVYhcZIjNrdXUDdp+Eq5AZ3Gkg8QAyVZRZIk4Tl4QAbF9cXJxNYZMAtAokgs4BrNxEpCtteXg7DDTMDKYNSuQdKsnJBek7HxewvxaosWxLYXtw+cJp18217wql4aKCfBNoEu0O5VU+PhctJ0YeXD4C6JQpyrlpSLTojpGGGN5YwNziChdIZLk4lvLcFJ9jMX3QdiImY9bmGQU+TRUL5CHITTRlgF8D9ouD1MfmLoEPl5xokIumZ2cfgMpHt47IW9N64Hsh7wQYYjyIugWuF5fCqYncXRd5vPMWyizzvhi/32+nvG0dZc9vR6fZOu0md5e+uC408FvKSIOZwXlGvxPv95izA2Vtvg1xKFWARI+vMX66HUhpQQb643uW1bSjuTWyw2SBvDrBvjFic1eGGlz5esq3ko9uSIlBRqPuFcCv8F4WIcN12nVaBd0SaYwI6PDDImR11JkqgHcPmQssjxIn6bUshygDFJUTxPMpHk+jfjPgupgdnYV2R/g7xSjtpah8RJBewhwf0gGK6XI92u4wXFEU40afJ4DN4h5LcAd+40HI3JgJecuT0c062W0i2hQJUTcxan3/CMW1PF2K6bbA+Daz4xRs1D3Br1Cm0OihKCqizW78/nXAF/G5TXrEcVzaNMH6CyMswqsAHqDyDLEyou8lwOXnKF8DjI6KjV3KzMBiXkDH8ij/H214J5A596ekrZ3F0zXlWeL7+P5eUrNo3/QwC15uxthuzidy7DzKRwEDaAViiDgKbTbz7CJnzo0bN7pIfIiid8SuPwn25o3QCmpnyjlZkyxPP8EomCJzrGb7GJMx7tNsq4MT2xMUYaiErZOluTzKsnz3gwCeCZyVRZJfYplNEokEjwrPtxlxjeYAk+F1F74VAzPxQRNYYdtpOUvWs8J1sGhBJMNsb7igN8plJs1eSmLIhLKE4rvaCX27gOhLpLOsIzJ7qn/i+wZzcvSOZ23/du8TZjwV8zHIXoP4R3ifBxiFz1dcVpa3aPntPE+c6TmIWE9EtcMmAcPdWAhYhAXxcLOQi9L1WhD1Sc8p1d2oL7XGiRKp8F4A2i8K/nfI+y/gsTDJ/YC/8+AD5Uh04KHiGl+cIFPnBDDrPMjwRGkLXyxO4VGbfQWnDH2v0bVWE3C9QOXlepbgjEfIJQI6XDG3z5ahD9cw2pS78ipB85wyScNTvsVzlzzhL8/jRrnmVjfFJK/m3m4nj9vbgQTguT8XZTjsm672R5uJKEaQmBI/c58gyus8ZDagLpEVSJBIyHp4jn++xqPV71OgQgJYEWOtZ/haxRtKmWOBu8xdBLftWltsY84zE6WIEy/eIOWL+BaayMx+KHtL7EAkqdNDLiEXmEMUHniedtJqg9HmZtfvt26vNi0BdG3Ft3g8ZOf7PAu59TxtzivLNIekyi+wD1i8CuUiD9FXAa8C+/xS3JPmZnomyc7H+fb4/Se0bk41Fel621r4cgVxbq91V4jVqwB7HTe2M7jgB+QWHavZkDRPmZcASoZEmBx6i75bGjPcMdL4/VKGFAGWZkGzPG0XAbdL9A81G5LOmUnC9hHKJeO7dcUMjblSl12867ElFTtaGl20xvvLGPdVz/8TVuU7y0x1PG7vtNg24oz9Uo/Z412++VFWI7Fcog9tu9Lm6gvRmIPv9x1xmQAu6RDkXtbOtlGEmpgD5Nvnyc0dcv0EE6cfdi1HmhMf9wDF3k3gtRvEedhxjpgfqPb9PU9iEJHnyOUA7bQUXh6kq/D7l2iTjWv7XOD530BDr8jIrus+srXjt4MzumJMHuTsBa63YKE1+RR5lBjEikCCnWKWiHdzOgKO+nRIBAF88za/IFmJ3eMZov4CYxGBabcpGL8EYx+SeMXJeRwHNsV/h+vdxeuhEpN3ZyNY78Gm2fknJxVGhyjixPiQvVkNzT1elD9Py/aTAL64Hb9vcYmC9zfdXdT/C1LeGbg4rnBaAihDFJH12W5ulfNCNe/xTsP3bp8ikzJs5BF+5PNfAQYAPaseTdsEcaYAAAAASUVORK5CYII='
\ No newline at end of file
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts
new file mode 100644
index 0000000..372795d
--- /dev/null
+++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts
@@ -0,0 +1,693 @@
+export type PaginationType = {
+ current : number,
+ size : number,
+ count : number
+}
+
+export type LoadMoreType = {
+ contentdown : string,
+ contentrefresh : string,
+ contentnomore : string
+}
+
+export type SelectedItemType = {
+ name : string,
+ value : string,
+}
+
+export type GetCommandOptions = {
+ collection ?: UTSJSONObject,
+ field ?: string,
+ orderby ?: string,
+ where ?: any,
+ pageData ?: string,
+ pageCurrent ?: number,
+ pageSize ?: number,
+ getCount ?: boolean,
+ getTree ?: any,
+ getTreePath ?: UTSJSONObject,
+ startwith ?: string,
+ limitlevel ?: number,
+ groupby ?: string,
+ groupField ?: string,
+ distinct ?: boolean,
+ pageIndistinct ?: boolean,
+ foreignKey ?: string,
+ loadtime ?: string,
+ manual ?: boolean
+}
+
+const DefaultSelectedNode = {
+ text: '请选择',
+ value: ''
+}
+
+export const dataPicker = defineMixin({
+ props: {
+ localdata: {
+ type: Array as PropType>,
+ default: [] as Array
+ },
+ collection: {
+ type: Object,
+ default: ''
+ },
+ field: {
+ type: String,
+ default: ''
+ },
+ orderby: {
+ type: String,
+ default: ''
+ },
+ where: {
+ type: Object,
+ default: ''
+ },
+ pageData: {
+ type: String,
+ default: 'add'
+ },
+ pageCurrent: {
+ type: Number,
+ default: 1
+ },
+ pageSize: {
+ type: Number,
+ default: 20
+ },
+ getcount: {
+ type: Boolean,
+ default: false
+ },
+ gettree: {
+ type: Object,
+ default: ''
+ },
+ gettreepath: {
+ type: Object,
+ default: ''
+ },
+ startwith: {
+ type: String,
+ default: ''
+ },
+ limitlevel: {
+ type: Number,
+ default: 10
+ },
+ groupby: {
+ type: String,
+ default: ''
+ },
+ groupField: {
+ type: String,
+ default: ''
+ },
+ distinct: {
+ type: Boolean,
+ default: false
+ },
+ pageIndistinct: {
+ type: Boolean,
+ default: false
+ },
+ foreignKey: {
+ type: String,
+ default: ''
+ },
+ loadtime: {
+ type: String,
+ default: 'auto'
+ },
+ manual: {
+ type: Boolean,
+ default: false
+ },
+ preload: {
+ type: Boolean,
+ default: false
+ },
+ stepSearh: {
+ type: Boolean,
+ default: true
+ },
+ selfField: {
+ type: String,
+ default: ''
+ },
+ parentField: {
+ type: String,
+ default: ''
+ },
+ multiple: {
+ type: Boolean,
+ default: false
+ },
+ value: {
+ type: Object,
+ default: ''
+ },
+ modelValue: {
+ type: Object,
+ default: ''
+ },
+ defaultProps: {
+ type: Object as PropType,
+ }
+ },
+ data() {
+ return {
+ loading: false,
+ error: null as UniCloudError | null,
+ treeData: [] as Array,
+ selectedIndex: 0,
+ selectedNodes: [] as Array,
+ selectedPages: [] as Array[],
+ selectedValue: '',
+ selectedPaths: [] as Array,
+ pagination: {
+ current: 1,
+ size: 20,
+ count: 0
+ } as PaginationType
+ }
+ },
+ computed: {
+ mappingTextName() : string {
+ // TODO
+ return (this.defaultProps != null) ? this.defaultProps!.getString('text', 'text') : 'text'
+ },
+ mappingValueName() : string {
+ // TODO
+ return (this.defaultProps != null) ? this.defaultProps!.getString('value', 'value') : 'value'
+ },
+ currentDataList() : Array {
+ if (this.selectedIndex > this.selectedPages.length - 1) {
+ return [] as Array
+ }
+ return this.selectedPages[this.selectedIndex]
+ },
+ isLocalData() : boolean {
+ return this.localdata.length > 0
+ },
+ isCloudData() : boolean {
+ return this._checkIsNotNull(this.collection)
+ },
+ isCloudDataList() : boolean {
+ return (this.isCloudData && (this.parentField.length == 0 && this.selfField.length == 0))
+ },
+ isCloudDataTree() : boolean {
+ return (this.isCloudData && this.parentField.length > 0 && this.selfField.length > 0)
+ },
+ dataValue() : any {
+ return this.hasModelValue ? this.modelValue : this.value
+ },
+ hasCloudTreeData() : boolean {
+ return this.treeData.length > 0
+ },
+ hasModelValue() : boolean {
+ if (typeof this.modelValue == 'string') {
+ const valueString = this.modelValue as string
+ return (valueString.length > 0)
+ } else if (Array.isArray(this.modelValue)) {
+ const valueArray = this.modelValue as Array
+ return (valueArray.length > 0)
+ }
+ return false
+ },
+ hasCloudDataValue() : boolean {
+ if (typeof this.dataValue == 'string') {
+ const valueString = this.dataValue as string
+ return (valueString.length > 0)
+ }
+ return false
+ }
+ },
+ created() {
+ this.pagination.current = this.pageCurrent
+ this.pagination.size = this.pageSize
+
+ this.$watch(
+ () : any => [
+ this.pageCurrent,
+ this.pageSize,
+ this.localdata,
+ this.value,
+ this.collection,
+ this.field,
+ this.getcount,
+ this.orderby,
+ this.where,
+ this.groupby,
+ this.groupField,
+ this.distinct
+ ],
+ (newValue : Array, oldValue : Array) => {
+ this.pagination.size = this.pageSize
+ if (newValue[0] !== oldValue[0]) {
+ this.pagination.current = this.pageCurrent
+ }
+
+ this.onPropsChange()
+ }
+ )
+ },
+ methods: {
+ onPropsChange() {
+ this.selectedIndex = 0
+ this.treeData.length = 0
+ this.selectedNodes.length = 0
+ this.selectedPages.length = 0
+ this.selectedPaths.length = 0
+
+ // 加载数据
+ this.$nextTick(() => {
+ this.loadData()
+ })
+ },
+
+ onTabSelect(index : number) {
+ this.selectedIndex = index
+ },
+
+ onNodeClick(nodeData : UTSJSONObject) {
+ if (nodeData.getBoolean('disable', false)) {
+ return
+ }
+
+ const isLeaf = this._checkIsLeafNode(nodeData)
+
+ this._trimSelectedNodes(nodeData)
+
+ this.$emit('nodeclick', nodeData)
+
+ if (this.isLocalData) {
+ if (isLeaf || !this._checkHasChildren(nodeData)) {
+ this.onFinish()
+ }
+ } else if (this.isCloudDataList) {
+ this.onFinish()
+ } else if (this.isCloudDataTree) {
+ if (isLeaf) {
+ this.onFinish()
+ } else if (!this._checkHasChildren(nodeData)) {
+ // 尝试请求一次,如果没有返回数据标记为叶子节点
+ this.loadCloudDataNode(nodeData)
+ }
+ }
+ },
+
+ getChangeNodes(): Array {
+ const nodes: Array = []
+ this.selectedNodes.forEach((node : UTSJSONObject) => {
+ const newNode: UTSJSONObject = {}
+ newNode[this.mappingTextName] = node.getString(this.mappingTextName)
+ newNode[this.mappingValueName] = node.getString(this.mappingValueName)
+ nodes.push(newNode)
+ })
+ return nodes
+ },
+
+ onFinish() { },
+
+ // 加载数据(自动判定环境)
+ loadData() {
+ if (this.isLocalData) {
+ this.loadLocalData()
+ } else if (this.isCloudDataList) {
+ this.loadCloudDataList()
+ } else if (this.isCloudDataTree) {
+ this.loadCloudDataTree()
+ }
+ },
+
+ // 加载本地数据
+ loadLocalData() {
+ this.treeData = this.localdata
+ if (Array.isArray(this.dataValue)) {
+ const value = this.dataValue as Array
+ this.selectedPaths = value.slice(0)
+ this._pushSelectedTreeNodes(value, this.localdata)
+ } else {
+ this._pushSelectedNodes(this.localdata)
+ }
+ },
+
+ // 加载 Cloud 数据 (单列)
+ loadCloudDataList() {
+ this._loadCloudData(null, (data : Array) => {
+ this.treeData = data
+ this._pushSelectedNodes(data)
+ })
+ },
+
+ // 加载 Cloud 数据 (树形)
+ loadCloudDataTree() {
+ let commandOptions = {
+ field: this._cloudDataPostField(),
+ where: this._cloudDataTreeWhere(),
+ getTree: true
+ } as GetCommandOptions
+ if (this._checkIsNotNull(this.gettree)) {
+ commandOptions.startwith = `${this.selfField}=='${this.dataValue as string}'`
+ }
+ this._loadCloudData(commandOptions, (data : Array) => {
+ this.treeData = data
+ if (this.selectedPaths.length > 0) {
+ this._pushSelectedTreeNodes(this.selectedPaths, data)
+ } else {
+ this._pushSelectedNodes(data)
+ }
+ })
+ },
+
+ // 加载 Cloud 数据 (节点)
+ loadCloudDataNode(nodeData : UTSJSONObject) {
+ const commandOptions = {
+ field: this._cloudDataPostField(),
+ where: this._cloudDataNodeWhere()
+ } as GetCommandOptions
+ this._loadCloudData(commandOptions, (data : Array) => {
+ nodeData['children'] = data
+ if (data.length == 0) {
+ nodeData['isleaf'] = true
+ this.onFinish()
+ } else {
+ this._pushSelectedNodes(data)
+ }
+ })
+ },
+
+ // 回显 Cloud Tree Path
+ loadCloudDataPath() {
+ if (!this.hasCloudDataValue) {
+ return
+ }
+
+ const command : GetCommandOptions = {}
+
+ // 单列
+ if (this.isCloudDataList) {
+ // 根据 field's as value标识匹配 where 条件
+ let where : Array = [];
+ let whereField = this._getForeignKeyByField();
+ if (whereField.length > 0) {
+ where.push(`${whereField} == '${this.dataValue as string}'`)
+ }
+
+ let whereString = where.join(' || ')
+ if (this._checkIsNotNull(this.where)) {
+ whereString = `(${this.where}) && (${whereString})`
+ }
+
+ command.field = this._cloudDataPostField()
+ command.where = whereString
+ }
+
+ // 树形
+ if (this.isCloudDataTree) {
+ command.field = this._cloudDataPostField()
+ command.getTreePath = {
+ startWith: `${this.selfField}=='${this.dataValue as string}'`
+ }
+ }
+
+ this._loadCloudData(command, (data : Array) => {
+ this._extractTreePath(data, this.selectedPaths)
+ })
+ },
+
+ _loadCloudData(options ?: GetCommandOptions, callback ?: ((data : Array) => void)) {
+ if (this.loading) {
+ return
+ }
+ this.loading = true
+
+ this.error = null
+
+ this._getCommand(options).then((response : UniCloudDBGetResult) => {
+ callback?.(response.data)
+ }).catch((err : any | null) => {
+ this.error = err as UniCloudError
+ }).finally(() => {
+ this.loading = false
+ })
+ },
+
+ _cloudDataPostField() : string {
+ let fields = [this.field];
+ if (this.parentField.length > 0) {
+ fields.push(`${this.parentField} as parent_value`)
+ }
+ return fields.join(',')
+ },
+
+ _cloudDataTreeWhere() : string {
+ let result : Array = []
+ let selectedNodes = this.selectedNodes.length > 0 ? this.selectedNodes : this.selectedPaths
+ let parentField = this.parentField
+ if (parentField.length > 0) {
+ result.push(`${parentField} == null || ${parentField} == ""`)
+ }
+ if (selectedNodes.length > 0) {
+ for (var i = 0; i < selectedNodes.length - 1; i++) {
+ const parentFieldValue = selectedNodes[i].getString('value', '')
+ result.push(`${parentField} == '${parentFieldValue}'`)
+ }
+ }
+
+ let where : Array = []
+ if (this._checkIsNotNull(this.where)) {
+ where.push(`(${this.where as string})`)
+ }
+
+ if (result.length > 0) {
+ where.push(`(${result.join(' || ')})`)
+ }
+
+ return where.join(' && ')
+ },
+
+ _cloudDataNodeWhere() : string {
+ const where : Array = []
+ if (this.selectedNodes.length > 0) {
+ const value = this.selectedNodes[this.selectedNodes.length - 1].getString('value', '')
+ where.push(`${this.parentField} == '${value}'`)
+ }
+
+ let whereString = where.join(' || ')
+ if (this._checkIsNotNull(this.where)) {
+ return `(${this.where as string}) && (${whereString})`
+ }
+
+ return whereString
+ },
+
+ _getWhereByForeignKey() : string {
+ let result : Array = []
+ let whereField = this._getForeignKeyByField();
+ if (whereField.length > 0) {
+ result.push(`${whereField} == '${this.dataValue as string}'`)
+ }
+
+ if (this._checkIsNotNull(this.where)) {
+ return `(${this.where}) && (${result.join(' || ')})`
+ }
+
+ return result.join(' || ')
+ },
+
+ _getForeignKeyByField() : string {
+ const fields = this.field.split(',')
+ let whereField = ''
+ for (let i = 0; i < fields.length; i++) {
+ const items = fields[i].split('as')
+ if (items.length < 2) {
+ continue
+ }
+ if (items[1].trim() === 'value') {
+ whereField = items[0].trim()
+ break
+ }
+ }
+ return whereField
+ },
+
+ _getCommand(options ?: GetCommandOptions) : Promise {
+ let db = uniCloud.databaseForJQL()
+
+ let collection = Array.isArray(this.collection) ? db.collection(...(this.collection as Array)) : db.collection(this.collection)
+
+ let filter : UniCloudDBFilter | null = null
+ if (this.foreignKey.length > 0) {
+ filter = collection.foreignKey(this.foreignKey)
+ }
+
+ const where : any = options?.where ?? this.where
+ if (typeof where == 'string') {
+ const whereString = where as string
+ if (whereString.length > 0) {
+ filter = (filter != null) ? filter.where(where) : collection.where(where)
+ }
+ } else {
+ filter = (filter != null) ? filter.where(where) : collection.where(where)
+ }
+
+ let query : UniCloudDBQuery | null = null
+ if (this.field.length > 0) {
+ query = (filter != null) ? filter.field(this.field) : collection.field(this.field)
+ }
+ if (this.groupby.length > 0) {
+ if (query != null) {
+ query = query.groupBy(this.groupby)
+ } else if (filter != null) {
+ query = filter.groupBy(this.groupby)
+ }
+ }
+ if (this.groupField.length > 0) {
+ if (query != null) {
+ query = query.groupField(this.groupField)
+ } else if (filter != null) {
+ query = filter.groupField(this.groupField)
+ }
+ }
+ if (this.distinct == true) {
+ if (query != null) {
+ query = query.distinct(this.field)
+ } else if (filter != null) {
+ query = filter.distinct(this.field)
+ }
+ }
+ if (this.orderby.length > 0) {
+ if (query != null) {
+ query = query.orderBy(this.orderby)
+ } else if (filter != null) {
+ query = filter.orderBy(this.orderby)
+ }
+ }
+
+ const size = this.pagination.size
+ const current = this.pagination.current
+ if (query != null) {
+ query = query.skip(size * (current - 1)).limit(size)
+ } else if (filter != null) {
+ query = filter.skip(size * (current - 1)).limit(size)
+ } else {
+ query = collection.skip(size * (current - 1)).limit(size)
+ }
+
+ const getOptions = {}
+ const treeOptions = {
+ limitLevel: this.limitlevel,
+ startWith: this.startwith
+ }
+ if (this.getcount == true) {
+ getOptions['getCount'] = this.getcount
+ }
+
+ const getTree : any = options?.getTree ?? this.gettree
+ if (typeof getTree == 'string') {
+ const getTreeString = getTree as string
+ if (getTreeString.length > 0) {
+ getOptions['getTree'] = treeOptions
+ }
+ } else if (typeof getTree == 'object') {
+ getOptions['getTree'] = treeOptions
+ } else {
+ getOptions['getTree'] = getTree
+ }
+
+ const getTreePath = options?.getTreePath ?? this.gettreepath
+ if (typeof getTreePath == 'string') {
+ const getTreePathString = getTreePath as string
+ if (getTreePathString.length > 0) {
+ getOptions['getTreePath'] = getTreePath
+ }
+ } else {
+ getOptions['getTreePath'] = getTreePath
+ }
+
+ return query.get(getOptions)
+ },
+
+ _checkIsNotNull(value : any) : boolean {
+ if (typeof value == 'string') {
+ const valueString = value as string
+ return (valueString.length > 0)
+ } else if (value instanceof UTSJSONObject) {
+ return true
+ }
+ return false
+ },
+
+ _checkIsLeafNode(nodeData : UTSJSONObject) : boolean {
+ if (this.selectedIndex >= this.limitlevel) {
+ return true
+ }
+
+ if (nodeData.getBoolean('isleaf', false)) {
+ return true
+ }
+
+ return false
+ },
+
+ _checkHasChildren(nodeData : UTSJSONObject) : boolean {
+ const children = nodeData.getArray('children') ?? ([] as Array)
+ return children.length > 0
+ },
+
+ _pushSelectedNodes(nodes : Array) {
+ this.selectedNodes.push(DefaultSelectedNode)
+ this.selectedPages.push(nodes)
+ this.selectedIndex = this.selectedPages.length - 1
+ },
+
+ _trimSelectedNodes(nodeData : UTSJSONObject) {
+ this.selectedNodes.splice(this.selectedIndex)
+ this.selectedNodes.push(nodeData)
+
+ if (this.selectedPages.length > 0) {
+ this.selectedPages.splice(this.selectedIndex + 1)
+ }
+
+ const children = nodeData.getArray('children') ?? ([] as Array)
+ if (children.length > 0) {
+ this.selectedNodes.push(DefaultSelectedNode)
+ this.selectedPages.push(children)
+ }
+
+ this.selectedIndex = this.selectedPages.length - 1
+ },
+
+ _pushSelectedTreeNodes(paths : Array, nodes : Array) {
+ let children : Array = nodes
+ paths.forEach((node : UTSJSONObject) => {
+ const findNode = children.find((item : UTSJSONObject) : boolean => {
+ return (item.getString(this.mappingValueName) == node.getString(this.mappingValueName))
+ })
+ if (findNode != null) {
+ this.selectedPages.push(children)
+ this.selectedNodes.push(node)
+ children = findNode.getArray('children') ?? ([] as Array)
+ }
+ })
+ this.selectedIndex = this.selectedPages.length - 1
+ },
+
+ _extractTreePath(nodes : Array, result : Array) {
+ if (nodes.length == 0) {
+ return
+ }
+
+ const node = nodes[0]
+ result.push(node)
+
+ const children = node.getArray('children')
+ if (Array.isArray(children) && children!.length > 0) {
+ this._extractTreePath(children, result)
+ }
+ }
+ }
+})
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css
new file mode 100644
index 0000000..39fe1c3
--- /dev/null
+++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css
@@ -0,0 +1,76 @@
+.uni-data-pickerview {
+ position: relative;
+ flex-direction: column;
+ overflow: hidden;
+}
+
+.loading-cover {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ align-items: center;
+ justify-content: center;
+ background-color: rgba(150, 150, 150, .1);
+}
+
+.error {
+ background-color: #fff;
+ padding: 15px;
+}
+
+.error-text {
+ color: #DD524D;
+}
+
+.selected-node-list {
+ flex-direction: row;
+ flex-wrap: nowrap;
+}
+
+.selected-node-item {
+ margin-left: 10px;
+ margin-right: 10px;
+ padding: 8px 10px 8px 10px;
+ border-bottom: 2px solid transparent;
+}
+
+.selected-node-item-active {
+ color: #007aff;
+ border-bottom-color: #007aff;
+}
+
+.list-view {
+ flex: 1;
+}
+
+.list-item {
+ flex-direction: row;
+ justify-content: space-between;
+ padding: 12px 15px;
+ border-bottom: 1px solid #f0f0f0;
+}
+
+.item-text {
+ color: #333333;
+}
+
+.item-text-disabled {
+ opacity: .5;
+}
+
+.item-text-overflow {
+ overflow: hidden;
+}
+
+.check {
+ margin-right: 5px;
+ border: 2px solid #007aff;
+ border-left: 0;
+ border-top: 0;
+ height: 12px;
+ width: 6px;
+ transform-origin: center;
+ transform: rotate(45deg);
+}
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue
new file mode 100644
index 0000000..f4780f3
--- /dev/null
+++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue
@@ -0,0 +1,69 @@
+
+
+
+ {{error!.errMsg}}
+
+
+
+
+
+ {{item[mappingTextName]}}
+
+
+
+
+
+
+ {{item[mappingTextName]}}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue
index e79f9bd..6ebced9 100644
--- a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue
+++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue
@@ -2,25 +2,27 @@
-
-
- {{item.text}}
+
+ {{item.text || ''}}
-
-
-
-
- {{item[map.text]}}
-
-
-
-
+
+
+ {{item[map.text]}}
+
+
+
diff --git a/uni_modules/uni-data-picker/package.json b/uni_modules/uni-data-picker/package.json
index 7b731fc..ba69c67 100644
--- a/uni_modules/uni-data-picker/package.json
+++ b/uni_modules/uni-data-picker/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-data-picker",
"displayName": "uni-data-picker 数据驱动的picker选择器",
- "version": "1.0.8",
+ "version": "2.0.2",
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
"keywords": [
"uni-ui",
@@ -48,12 +48,15 @@
"platforms": {
"cloud": {
"tcb": "y",
- "aliyun": "y"
+ "aliyun": "y",
+ "alipay": "n"
},
"client": {
"App": {
- "app-vue": "y",
- "app-nvue": "u"
+ "app-vue": "y",
+ "app-nvue": "y",
+ "app-uvue": "y",
+ "app-harmony": "u"
},
"H5-mobile": {
"Safari": "y",
@@ -87,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/uni_modules/uni-data-picker/readme.md b/uni_modules/uni-data-picker/readme.md
index 6cda224..19dd0e8 100644
--- a/uni_modules/uni-data-picker/readme.md
+++ b/uni_modules/uni-data-picker/readme.md
@@ -19,4 +19,4 @@
在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”,这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面,会自动生成地址管理的维护页面,自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker)
-#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
+#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
diff --git a/uni_modules/uni-data-select/changelog.md b/uni_modules/uni-data-select/changelog.md
index 9e48c69..1681eae 100644
--- a/uni_modules/uni-data-select/changelog.md
+++ b/uni_modules/uni-data-select/changelog.md
@@ -1,3 +1,32 @@
+## 1.1.0(2025-08-19)
+- 新增 插槽 selected empty option
+- 新增 mutiple 属性,支持多选功能
+- 新增 wrap 属性,支持选中的文字超过一行显示
+- 新增 align 属性,支持修改选中的文字显示的位置
+- 新增 hideRight 属性,支持隐藏右侧所有按钮
+- 新增 mode 属性,支持修改边框样式
+- 新增 事件 open close clear
+## 1.0.10(2025-04-14)
+- 修复 清除按钮不展示问题
+## 1.0.9(2025-03-26)
+- 优化 默认背景为白色与整体组件保持风格统一
+## 1.0.8(2024-03-28)
+- 修复 在vue2下:style动态绑定导致编译失败的bug
+## 1.0.7(2024-01-20)
+- 修复 长文本回显超过容器的bug,超过容器部分显示省略号
+## 1.0.6(2023-04-12)
+- 修复 微信小程序点击时会改变背景颜色的 bug
+## 1.0.5(2023-02-03)
+- 修复 禁用时会显示清空按钮
+## 1.0.4(2023-02-02)
+- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
+- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
+## 1.0.3(2023-01-16)
+- 修复 不关联服务空间报错的问题
+## 1.0.2(2023-01-14)
+- 新增 属性 `format` 可用于格式化显示选项内容
+## 1.0.1(2022-12-06)
+- 修复 当where变化时,数据不会自动更新的问题
## 0.1.9(2022-09-05)
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.8(2022-08-29)
diff --git a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
index 919ffe3..85b2d7b 100644
--- a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
+++ b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
@@ -2,27 +2,59 @@
{{label + ':'}}
-
-
- {{current}}
- {{typePlaceholder}}
-
-
+
+
+
+
+
+
+
+ {{textShow}}
+
+ {{typePlaceholder}}
+
+
+
+
+
+
+
-
-
-
-
- {{emptyTips}}
-
-
- {{formatItemName(item)}}
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{emptyTips}}
+
+
+
+
+
+
+
+
+
+ {{formatItemName(item)}}
+
+
+
+
+
+
+
+
+
@@ -33,27 +65,55 @@
* DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
- * @property {String} value 默认值
+ * @property {String|Array} value 默认值,多选时为数组
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
+ * @property {Boolean} multiple 是否多选模式
+ * @property {Boolean} wrap 是否允许选中文本换行显示
+ * @property {String} placement 弹出位置
+ * @value top 顶部弹出
+ * @value bottom 底部弹出(default)
+ * @property {String} align 选择文字的位置
+ * @value left 显示左侧
+ * @value center 显示中间
+ * @value right 显示 右侧
+ * @property {Boolean} hideRight 是否隐藏右侧按钮
+ * @property {String} mode 边框样式
+ * @value default 四周边框
+ * @value underline 下边框
+ * @value none 无边框
* @event {Function} change 选中发生变化触发
+ * @event {Function} open 选择框开启时触发
+ * @event {Function} close 选择框关闭时触发
+ * @event {Function} clear 点击清除按钮之后触发
*/
export default {
- name: "uni-stat-select",
+ name: "uni-data-select",
mixins: [uniCloud.mixinDatacom || {}],
- data() {
- return {
- showSelector: false,
- current: '',
- mixinDatacomResData: [],
- apps: [],
- channels: []
- };
+ emits: [
+ 'open',
+ 'close',
+ 'update:modelValue',
+ 'input',
+ 'clear',
+ 'change'
+ ],
+ model: {
+ prop: 'modelValue',
+ event: 'update:modelValue'
+ },
+ options: {
+ // #ifdef MP-TOUTIAO
+ virtualHost: false,
+ // #endif
+ // #ifndef MP-TOUTIAO
+ virtualHost: true
+ // #endif
},
props: {
localdata: {
@@ -63,11 +123,11 @@
}
},
value: {
- type: [String, Number],
+ type: [String, Number, Array],
default: ''
},
modelValue: {
- type: [String, Number],
+ type: [String, Number, Array],
default: ''
},
label: {
@@ -90,15 +150,56 @@
type: Number,
default: 0
},
- disabled: {
+ disabled: {
type: Boolean,
default: false
- }
+ },
+ // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
+ format: {
+ type: String,
+ default: ''
+ },
+ placement: {
+ type: String,
+ default: 'bottom'
+ },
+ multiple: {
+ type: Boolean,
+ default: false
+ },
+ wrap: {
+ type: Boolean,
+ default: false
+ },
+ align:{
+ type: String,
+ default: "left"
+ },
+ hideRight: {
+ type: Boolean,
+ default: false
+ },
+ mode:{
+ type: String,
+ default: 'default'
+ }
+ },
+ data() {
+ return {
+ showSelector: false,
+ current: '',
+ mixinDatacomResData: [],
+ apps: [],
+ channels: [],
+ cacheKey: "uni-data-select-lastSelectedValue",
+ };
},
created() {
- this.last = `${this.collection}_last_selected_option_value`
+ this.debounceGet = this.debounce(() => {
+ this.query();
+ }, 300);
if (this.collection && !this.localdata.length) {
- this.mixinDatacomEasyGet()
+ this.debounceGet();
}
},
computed: {
@@ -113,9 +214,77 @@
return placeholder ?
common + placeholder :
common
+ },
+ valueCom() {
+ if (this.value === '') return this.modelValue
+ if (this.modelValue === '') return this.value
+ return this.value
+ },
+ textShow() {
+ // 长文本显示
+ if (this.multiple) {
+ const currentValues = this.getCurrentValues();
+ if (Array.isArray(currentValues) && currentValues.length > 0) {
+ const selectedItems = this.mixinDatacomResData.filter(item => currentValues.includes(item.value));
+ return selectedItems.map(item => this.formatItemName(item)).join(', ');
+ } else {
+ return ''; // 空数组时返回空字符串,显示占位符
+ }
+ } else {
+ return this.current;
+ }
+ },
+ shouldShowClear() {
+ if (this.multiple) {
+ const currentValues = this.getCurrentValues();
+ return Array.isArray(currentValues) && currentValues.length > 0;
+ } else {
+ return !!this.current;
+ }
+ },
+ shouldWrap() {
+ // 只有在多选模式、开启换行、且有内容时才应用换行样式
+ return this.multiple && this.wrap && !!this.textShow;
+ },
+ getOffsetByPlacement() {
+ switch (this.placement) {
+ case 'top':
+ return "bottom:calc(100% + 12px);";
+ case 'bottom':
+ return "top:calc(100% + 12px);";
+ }
+ },
+ slotSelected(){
+ // #ifdef VUE2
+ return this.$scopedSlots ? this.$scopedSlots.selected : false
+ // #endif
+ // #ifdef VUE3
+ return this.$slots ? this.$slots.selected : false
+ // #endif
+ },
+ slotEmpty(){
+ // #ifdef VUE2
+ return this.$scopedSlots ? this.$scopedSlots.empty : false
+ // #endif
+ // #ifdef VUE3
+ return this.$slots ? this.$slots.empty : false
+ // #endif
+ },
+ slotOption(){
+ // #ifdef VUE2
+ return this.$scopedSlots ? this.$scopedSlots.option : false
+ // #endif
+ // #ifdef VUE3
+ return this.$slots ? this.$slots.option : false
+ // #endif
}
},
watch: {
+ showSelector:{
+ handler(val,old){
+ val ? this.$emit('open') : this.$emit('close')
+ }
+ },
localdata: {
immediate: true,
handler(val, old) {
@@ -124,16 +293,9 @@
}
}
},
- // #ifndef VUE3
- value() {
+ valueCom(val, old) {
this.initDefVal()
},
- // #endif
- // #ifdef VUE3
- modelValue() {
- this.initDefVal()
- },
- // #endif
mixinDatacomResData: {
immediate: true,
handler(val) {
@@ -141,77 +303,182 @@
this.initDefVal()
}
}
- }
+ },
},
methods: {
+ getSelectedItems() {
+ const currentValues = this.getCurrentValues();
+ let _minxData = this.mixinDatacomResData
+ // #ifdef MP-WEIXIN || MP-TOUTIAO
+ _minxData = JSON.parse(JSON.stringify(this.mixinDatacomResData))
+ // #endif
+ if (this.multiple) {
+ return _minxData.filter(item => currentValues.includes(item.value)) || [];
+ } else {
+ return _minxData.filter(item => item.value === currentValues) || [];
+ }
+ },
+ debounce(fn, time = 100) {
+ let timer = null
+ return function(...args) {
+ if (timer) clearTimeout(timer)
+ timer = setTimeout(() => {
+ fn.apply(this, args)
+ }, time)
+ }
+ },
+ // 检查项目是否已选中
+ isSelected(item) {
+ if (this.multiple) {
+ const currentValues = this.getCurrentValues();
+ return Array.isArray(currentValues) && currentValues.includes(item.value);
+ } else {
+ return this.getCurrentValues() === item.value;
+ }
+ },
+ // 获取当前选中的值
+ getCurrentValues() {
+ if (this.multiple) {
+ return Array.isArray(this.valueCom) ? this.valueCom : (this.valueCom ? [this.valueCom] : []);
+ } else {
+ return this.valueCom;
+ }
+ },
+ // 执行数据库查询
+ query() {
+ this.mixinDatacomEasyGet();
+ },
+ // 监听查询条件变更事件
+ onMixinDatacomPropsChange() {
+ if (this.collection) {
+ this.debounceGet();
+ }
+ },
initDefVal() {
- let defValue = ''
- if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
- defValue = this.value
- } else if ((this.modelValue || this.modelValue === 0) && !this.isDisabled(this.modelValue)) {
- defValue = this.modelValue
+ let defValue = this.multiple ? [] : ''
+ if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
+ defValue = this.valueCom
} else {
let strogeValue
if (this.collection) {
- strogeValue = uni.getStorageSync(this.last)
+ strogeValue = this.getCache()
}
if (strogeValue || strogeValue === 0) {
defValue = strogeValue
} else {
- let defItem = ''
- if (this.defItem > 0 && this.defItem < this.mixinDatacomResData.length) {
- defItem = this.mixinDatacomResData[this.defItem - 1].value
+ let defItem = this.multiple ? [] : ''
+ if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
+ defItem = this.multiple ? [this.mixinDatacomResData[this.defItem - 1].value] : this.mixinDatacomResData[this.defItem - 1].value
}
defValue = defItem
}
- this.emit(defValue)
+ if (defValue || defValue === 0 || (this.multiple && Array.isArray(defValue) && defValue.length > 0)) {
+ this.emit(defValue)
+ }
+ }
+
+ if (this.multiple) {
+ const selectedValues = Array.isArray(defValue) ? defValue : (defValue ? [defValue] : []);
+ const selectedItems = this.mixinDatacomResData.filter(item => selectedValues.includes(item.value));
+ this.current = selectedItems.map(item => this.formatItemName(item));
+ } else {
+ const def = this.mixinDatacomResData.find(item => item.value === defValue)
+ this.current = def ? this.formatItemName(def) : ''
}
- const def = this.mixinDatacomResData.find(item => item.value === defValue)
- this.current = def ? this.formatItemName(def) : ''
},
/**
- * @param {[String, Number]} value
+ * @param {[String, Number, Array]} value
* 判断用户给的 value 是否同时为禁用状态
*/
isDisabled(value) {
- let isDisabled = false;
-
- this.mixinDatacomResData.forEach(item => {
- if (item.value === value) {
- isDisabled = item.disable
- }
- })
-
- return isDisabled;
- },
-
- clearVal() {
- this.emit('')
- if (this.collection) {
- uni.removeStorageSync(this.last)
+ if (Array.isArray(value)) {
+ // 对于数组,如果任意一个值被禁用,则认为整体被禁用
+ return value.some(val => {
+ return this.mixinDatacomResData.some(item => item.value === val && item.disable);
+ });
+ } else {
+ let isDisabled = false;
+ this.mixinDatacomResData.forEach(item => {
+ if (item.value === value) {
+ isDisabled = item.disable
+ }
+ })
+ return isDisabled;
}
},
+ clearVal() {
+ const emptyValue = this.multiple ? [] : '';
+ this.emit(emptyValue)
+ this.current = this.multiple ? [] : ''
+ if (this.collection) {
+ this.removeCache()
+ }
+ this.$emit('clear')
+ },
+ checkBoxChange(res){
+ let range = res.detail.value
+
+ let currentValues = range && range.length > 0? range.map((item)=>{
+ const index = parseInt(item, 10);
+
+ if (isNaN(index)) {
+ console.error(`无效索引: ${item}`);
+ }
+
+ if (index < 0 || index >= this.mixinDatacomResData.length) {
+ console.error(`索引越界: ${index}`);
+ }
+
+ return this.mixinDatacomResData[index].value;
+ }) : []
+ const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
+ this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
+
+ this.emit(currentValues);
+ },
change(item) {
if (!item.disable) {
- this.showSelector = false
- this.current = this.formatItemName(item)
- this.emit(item.value)
+ if (this.multiple) {
+ // 多选模式
+ let currentValues = this.getCurrentValues();
+ if (!Array.isArray(currentValues)) {
+ currentValues = currentValues ? [currentValues] : [];
+ }
+
+ const itemValue = item.value;
+ const index = currentValues.indexOf(itemValue);
+
+ if (index > -1) {
+ currentValues.splice(index, 1);
+ } else {
+ currentValues.push(itemValue);
+ }
+
+ const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
+ this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
+
+ this.emit(currentValues);
+ } else {
+ // 单选模式
+ this.showSelector = false
+ this.current = this.formatItemName(item)
+ this.emit(item.value)
+ }
}
},
emit(val) {
- this.$emit('change', val)
this.$emit('input', val)
this.$emit('update:modelValue', val)
+ this.$emit('change', val)
if (this.collection) {
- uni.setStorageSync(this.last, val)
+ this.setCache(val);
}
},
-
toggleSelector() {
- if(this.disabled){
- return
- }
+ if (this.disabled) {
+ return
+ }
this.showSelector = !this.showSelector
},
@@ -222,14 +489,50 @@
channel_code
} = item
channel_code = channel_code ? `(${channel_code})` : ''
- return this.collection.indexOf('app-list') > 0 ?
- `${text}(${value})` :
- (
- text ?
- text :
- `未命名${channel_code}`
- )
- }
+
+ if (this.format) {
+ // 格式化输出
+ let str = "";
+ str = this.format;
+ for (let key in item) {
+ str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
+ }
+ return str;
+ } else {
+ return this.collection.indexOf('app-list') > 0 ?
+ `${text}(${value})` :
+ (
+ text ?
+ text :
+ `未命名${channel_code}`
+ )
+ }
+ },
+ // 获取当前加载的数据
+ getLoadData() {
+ return this.mixinDatacomResData;
+ },
+ // 获取当前缓存key
+ getCurrentCacheKey() {
+ return this.collection;
+ },
+ // 获取缓存
+ getCache(name = this.getCurrentCacheKey()) {
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
+ return cacheData[name];
+ },
+ // 设置缓存
+ setCache(value, name = this.getCurrentCacheKey()) {
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
+ cacheData[name] = value;
+ uni.setStorageSync(this.cacheKey, cacheData);
+ },
+ // 删除缓存
+ removeCache(name = this.getCurrentCacheKey()) {
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
+ delete cacheData[name];
+ uni.setStorageSync(this.cacheKey, cacheData);
+ },
}
}
@@ -239,7 +542,11 @@
$uni-main-color: #333 !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
-
+ $uni-primary: #2979ff !default;
+ $uni-success: #4cd964 !default;
+ $uni-warning: #f0ad4e !default;
+ $uni-error: #dd524d !default;
+ $uni-info: #909399 !default;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
@@ -253,13 +560,16 @@
display: flex;
align-items: center;
// padding: 15px;
+ /* #ifdef H5 */
cursor: pointer;
+ /* #endif */
width: 100%;
flex: 1;
box-sizing: border-box;
}
.uni-stat-box {
+ background-color: #fff;
width: 100%;
flex: 1;
}
@@ -278,9 +588,16 @@
margin-right: 5px;
}
+ .border-bottom {
+ border-bottom: solid 1px $uni-border-3;
+ }
+
+ .border-default {
+ border: 1px solid $uni-border-3;
+ }
+
.uni-select {
font-size: 14px;
- border: 1px solid $uni-border-3;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
@@ -292,15 +609,20 @@
/* #endif */
flex-direction: row;
align-items: center;
- border-bottom: solid 1px $uni-border-3;
width: 100%;
flex: 1;
- height: 35px;
+ min-height: 35px;
- &--disabled{
- background-color: #f5f7fa;
- cursor: not-allowed;
- }
+ &--disabled {
+ background-color: #f5f7fa;
+ cursor: not-allowed;
+ }
+
+ &--wrap {
+ height: auto;
+ min-height: 35px;
+ // align-items: flex-start;
+ }
}
.uni-select__label {
@@ -312,7 +634,8 @@
}
.uni-select__input-box {
- height: 35px;
+ // height: 35px;
+ width: 0px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
@@ -320,6 +643,24 @@
flex: 1;
flex-direction: row;
align-items: center;
+
+ &--wrap {
+ .uni-select__input-text {
+ margin-right: 8px;
+ }
+ }
+
+ .padding-top-bottom {
+ padding-top: 5px;
+ padding-bottom: 5px;
+ }
+
+ .slot-content {
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ }
}
.uni-select__input {
@@ -339,7 +680,6 @@
box-sizing: border-box;
/* #endif */
position: absolute;
- top: calc(100% + 12px);
left: 0;
width: 100%;
background-color: #FFFFFF;
@@ -357,21 +697,33 @@
/* #endif */
}
+ /* #ifdef H5 */
+ @media (min-width: 768px) {
+ .uni-select__selector-scroll {
+ max-height: 600px;
+ }
+ }
+
+ /* #endif */
+
.uni-select__selector-empty,
.uni-select__selector-item {
/* #ifndef APP-NVUE */
display: flex;
cursor: pointer;
/* #endif */
+ flex-direction: row;
+ align-items: center;
line-height: 35px;
font-size: 14px;
- text-align: center;
/* border-bottom: solid 1px $uni-border-3; */
padding: 0px 10px;
}
- .uni-select__selector-item:hover {
- background-color: #f9f9f9;
+
+
+ .uni-select__selector-item-check {
+ margin-left: auto;
}
.uni-select__selector-empty:last-child,
@@ -387,8 +739,10 @@
}
/* picker 弹出层通用的指示小三角 */
- .uni-popper__arrow,
- .uni-popper__arrow::after {
+ .uni-popper__arrow_bottom,
+ .uni-popper__arrow_bottom::after,
+ .uni-popper__arrow_top,
+ .uni-popper__arrow_top::after {
position: absolute;
display: block;
width: 0;
@@ -398,7 +752,7 @@
border-width: 6px;
}
- .uni-popper__arrow {
+ .uni-popper__arrow_bottom {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
@@ -407,7 +761,7 @@
border-bottom-color: #EBEEF5;
}
- .uni-popper__arrow::after {
+ .uni-popper__arrow_bottom::after {
content: " ";
top: 1px;
margin-left: -6px;
@@ -415,6 +769,24 @@
border-bottom-color: #fff;
}
+ .uni-popper__arrow_top {
+ filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
+ bottom: -6px;
+ left: 10%;
+ margin-right: 3px;
+ border-bottom-width: 0;
+ border-top-color: #EBEEF5;
+ }
+
+ .uni-popper__arrow_top::after {
+ content: " ";
+ bottom: 1px;
+ margin-left: -6px;
+ border-bottom-width: 0;
+ border-top-color: #fff;
+ }
+
+
.uni-select__input-text {
// width: 280px;
width: 100%;
@@ -423,11 +795,22 @@
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
+
+ &--wrap {
+ white-space: normal;
+ text-overflow: initial;
+ -o-text-overflow: initial;
+ overflow: visible;
+ word-wrap: break-word;
+ word-break: break-all;
+ // line-height: 1.5;
+ }
}
.uni-select__input-placeholder {
color: $uni-base-color;
font-size: 12px;
+ margin: 1px 0;
}
.uni-select--mask {
@@ -436,5 +819,19 @@
bottom: 0;
right: 0;
left: 0;
+ z-index: 2;
}
+
+ .align-left {
+ text-align: left;
+ }
+
+ .align-center {
+ text-align: center;
+ }
+
+ .align-right {
+ text-align: right;
+ }
+
diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json
index 2a203ca..4033502 100644
--- a/uni_modules/uni-data-select/package.json
+++ b/uni_modules/uni-data-select/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
- "version": "0.1.9",
+ "version": "1.1.0",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
@@ -12,12 +12,14 @@
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
- "HBuilderX": "^3.1.1"
+ "HBuilderX": "^3.1.1",
+ "uni-app": "^4.45",
+ "uni-app-x": ""
},
"directories": {
"example": "../../temps/example_temps"
},
-"dcloudext": {
+ "dcloudext": {
"sale": {
"regular": {
"price": "0.00"
@@ -35,51 +37,70 @@
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
- "type": "component-vue"
+ "type": "component-vue",
+ "darkmode": "x",
+ "i18n": "x",
+ "widescreen": "x"
},
"uni_modules": {
- "dependencies": ["uni-load-more"],
+ "dependencies": [
+ "uni-load-more"
+ ],
"encrypt": [],
"platforms": {
"cloud": {
- "tcb": "y",
- "aliyun": "y"
+ "tcb": "√",
+ "aliyun": "√",
+ "alipay": "√"
},
"client": {
- "App": {
- "app-vue": "u",
- "app-nvue": "n"
+ "uni-app": {
+ "vue": {
+ "vue2": "√",
+ "vue3": "√"
+ },
+ "web": {
+ "safari": "√",
+ "chrome": "√"
+ },
+ "app": {
+ "vue": "√",
+ "nvue": "-",
+ "android": "√",
+ "ios": "√",
+ "harmony": "√"
+ },
+ "mp": {
+ "weixin": "√",
+ "alipay": "√",
+ "toutiao": "√",
+ "baidu": "-",
+ "kuaishou": "-",
+ "jd": "-",
+ "harmony": "-",
+ "qq": "-",
+ "lark": "-"
+ },
+ "quickapp": {
+ "huawei": "-",
+ "union": "-"
+ }
},
- "H5-mobile": {
- "Safari": "y",
- "Android Browser": "y",
- "微信浏览器(Android)": "y",
- "QQ浏览器(Android)": "y"
- },
- "H5-pc": {
- "Chrome": "y",
- "IE": "y",
- "Edge": "y",
- "Firefox": "y",
- "Safari": "y"
- },
- "小程序": {
- "微信": "y",
- "阿里": "u",
- "百度": "u",
- "字节跳动": "u",
- "QQ": "u",
- "京东": "u"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- },
- "Vue": {
- "vue2": "y",
- "vue3": "y"
+ "uni-app-x": {
+ "web": {
+ "safari": "-",
+ "chrome": "-"
+ },
+ "app": {
+ "android": "-",
+ "ios": "-",
+ "harmony": "-"
+ },
+ "mp": {
+ "weixin": "-"
+ }
}
}
}
}
-}
+}
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/changelog.md b/uni_modules/uni-datetime-picker/changelog.md
index 9f09862..1eee75e 100644
--- a/uni_modules/uni-datetime-picker/changelog.md
+++ b/uni_modules/uni-datetime-picker/changelog.md
@@ -1,41 +1,111 @@
+## 2.2.42(2025-08-20)
+- 修复 datetime-picker 小程序样式警告
+## 2.2.41(2025-08-20)
+- 修复 uni-datetime-picker组件时间对比报错问题
+## 2.2.40(2025-04-14)
+- 修复 绑定字符串值的时,日历面板选中状态未重置到默认值的问题
+## 2.2.39(2025-04-14)
+- 修复 在 iOS 微信小程序上type='daterange'时,传入'YYYY-MM-DD'格式不生效的问题
+
+## 2.2.38(2024-10-15)
+- 修复 微信小程序中的getSystemInfo警告
+## 2.2.35(2024-09-21)
+- 修复 没有选中日期时点击确定直接报错的Bug [详情](https://ask.dcloud.net.cn/question/198168)
+## 2.2.34(2024-04-24)
+- 新增 日期点击事件,在点击日期时会触发该事件。
+## 2.2.33(2024-04-15)
+- 修复 抖音小程序事件传递失效bug
+## 2.2.32(2024-02-20)
+- 修复 日历的close事件触发异常的bug [详情](https://github.com/dcloudio/uni-ui/issues/844)
+## 2.2.31(2024-02-20)
+- 修复 h5平台 右边日历的月份默认+1的bug [详情](https://github.com/dcloudio/uni-ui/issues/841)
+## 2.2.30(2024-01-31)
+- 修复 隐藏“秒”时,在IOS15及以下版本时出现 结束时间在开始时间之前 的bug [详情](https://github.com/dcloudio/uni-ui/issues/788)
+## 2.2.29(2024-01-20)
+- 新增 show事件,弹窗弹出时触发该事件 [详情](https://github.com/dcloudio/uni-app/issues/4694)
+## 2.2.28(2024-01-18)
+- 去除 noChange事件,当进行日期范围选择时,若只选了一天,则开始结束日期都为同一天 [详情](https://github.com/dcloudio/uni-ui/issues/815)
+## 2.2.27(2024-01-10)
+- 优化 增加noChange事件,当进行日期范围选择时,若有空值,则触发该事件 [详情](https://github.com/dcloudio/uni-ui/issues/815)
+## 2.2.26(2024-01-08)
+- 修复 字节小程序时间选择范围器失效问题 [详情](https://github.com/dcloudio/uni-ui/issues/834)
+## 2.2.25(2023-10-18)
+- 修复 PC端初次修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
+## 2.2.24(2023-06-02)
+- 修复 部分情况修改时间,开始、结束时间显示异常的Bug [详情](https://ask.dcloud.net.cn/question/171146)
+- 优化 当前月可以选择上月、下月的日期的Bug
+## 2.2.23(2023-05-02)
+- 修复 部分情况修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
+- 修复 部分平台及设备第一次点击无法显示弹框的Bug
+- 修复 ios 日期格式未补零显示及使用异常的Bug [详情](https://ask.dcloud.net.cn/question/162979)
+## 2.2.22(2023-03-30)
+- 修复 日历 picker 修改年月后,自动选中当月1日的Bug [详情](https://ask.dcloud.net.cn/question/165937)
+- 修复 小程序端 低版本 ios NaN的Bug [详情](https://ask.dcloud.net.cn/question/162979)
+## 2.2.21(2023-02-20)
+- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362)
+## 2.2.20(2023-02-17)
+- 优化 值为空依然选中当天问题
+- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间
+- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间
+- 优化 字节小程序日期时间范围选择,底部日期换行的Bug
+## 2.2.19(2023-02-09)
+- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686)
+## 2.2.18(2023-02-08)
+- 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684)
+- 优化 PC端输入日期格式错误时返回当前日期时间
+- 优化 PC端输入日期时间超出 start、end 限制的Bug
+- 优化 移动端日期时间范围用法时间展示不完整问题
+## 2.2.17(2023-02-04)
+- 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679)
+- 修复 vue3 time-picker 无法显示绑定时分秒的Bug
+## 2.2.16(2023-02-02)
+- 修复 字节小程序报错的Bug
+## 2.2.15(2023-02-02)
+- 修复 某些情况切换月份错误的Bug
+## 2.2.14(2023-01-30)
+- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/162033)
+## 2.2.13(2023-01-10)
+- 修复 多次加载组件造成内存占用的Bug
+## 2.2.12(2022-12-01)
+- 修复 vue3 下 i18n 国际化初始值不正确的Bug
## 2.2.11(2022-09-19)
-- 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861)
+- 修复 支付宝小程序样式错乱的Bug [详情](https://github.com/dcloudio/uni-app/issues/3861)
## 2.2.10(2022-09-19)
-- 修复,反向选择日期范围,日期显示异常,[详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
+- 修复 反向选择日期范围,日期显示异常的Bug [详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
## 2.2.9(2022-09-16)
- 可以使用 uni-scss 控制主题色
## 2.2.8(2022-09-08)
-- 修复 close事件无效的 bug
+- 修复 close事件无效的Bug
## 2.2.7(2022-09-05)
-- 修复 移动端 maskClick 无效的 bug,详见:[https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false](https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false)
+- 修复 移动端 maskClick 无效的Bug [详情](https://ask.dcloud.net.cn/question/140824)
## 2.2.6(2022-06-30)
- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致
## 2.2.5(2022-06-24)
-- 修复 日历顶部年月及底部确认未国际化 bug
+- 修复 日历顶部年月及底部确认未国际化的Bug
## 2.2.4(2022-03-31)
-- 修复 Vue3 下动态赋值,单选类型未响应的 bug
+- 修复 Vue3 下动态赋值,单选类型未响应的Bug
## 2.2.3(2022-03-28)
-- 修复 Vue3 下动态赋值未响应的 bug
+- 修复 Vue3 下动态赋值未响应的Bug
## 2.2.2(2021-12-10)
-- 修复 clear-icon 属性在小程序平台不生效的 bug
+- 修复 clear-icon 属性在小程序平台不生效的Bug
## 2.2.1(2021-12-10)
-- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug
+- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的Bug
## 2.2.0(2021-11-19)
-- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
-- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
-## 2.1.5(2021-11-09)
+- 优化 组件UI,并提供设计资源 [详情](https://uniapp.dcloud.io/component/uniui/resource)
+- 文档迁移 [https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
+## 2.1.5(2021-11-09)
- 新增 提供组件设计资源,组件样式调整
## 2.1.4(2021-09-10)
-- 修复 hide-second 在移动端的 bug
-- 修复 单选赋默认值时,赋值日期未高亮的 bug
-- 修复 赋默认值时,移动端未正确显示时间的 bug
+- 修复 hide-second 在移动端的Bug
+- 修复 单选赋默认值时,赋值日期未高亮的Bug
+- 修复 赋默认值时,移动端未正确显示时间的Bug
## 2.1.3(2021-09-09)
- 新增 hide-second 属性,支持只使用时分,隐藏秒
## 2.1.2(2021-09-03)
- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次
- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法
- 优化 调整字号大小,美化日历界面
-- 修复 因国际化导致的 placeholder 失效的 bug
+- 修复 因国际化导致的 placeholder 失效的Bug
## 2.1.1(2021-08-24)
- 新增 支持国际化
- 优化 范围选择器在 pc 端过宽的问题
@@ -43,50 +113,50 @@
- 新增 适配 vue3
## 2.0.19(2021-08-09)
- 新增 支持作为 uni-forms 子组件相关功能
-- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug
+- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的Bug
## 2.0.18(2021-08-05)
-- 修复 type 属性动态赋值无效的 bug
+- 修复 type 属性动态赋值无效的Bug
- 修复 ‘确认’按钮被 tabbar 遮盖 bug
-- 修复 组件未赋值时范围选左、右日历相同的 bug
+- 修复 组件未赋值时范围选左、右日历相同的Bug
## 2.0.17(2021-08-04)
-- 修复 范围选未正确显示当前值的 bug
-- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug
+- 修复 范围选未正确显示当前值的Bug
+- 修复 h5 平台(移动端)报错 'cale' of undefined 的Bug
## 2.0.16(2021-07-21)
- 新增 return-type 属性支持返回 date 日期对象
## 2.0.15(2021-07-14)
-- 修复 单选日期类型,初始赋值后不在当前日历的 bug
+- 修复 单选日期类型,初始赋值后不在当前日历的Bug
- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效)
- 优化 移动端移除显示框的清空按钮,无实际用途
## 2.0.14(2021-07-14)
-- 修复 组件赋值为空,界面未更新的 bug
-- 修复 start 和 end 不能动态赋值的 bug
-- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug
+- 修复 组件赋值为空,界面未更新的Bug
+- 修复 start 和 end 不能动态赋值的Bug
+- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的Bug
## 2.0.13(2021-07-08)
-- 修复 范围选择不能动态赋值的 bug
+- 修复 范围选择不能动态赋值的Bug
## 2.0.12(2021-07-08)
- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug
## 2.0.11(2021-07-08)
- 优化 弹出层在超出视窗边缘定位不准确的问题
## 2.0.10(2021-07-08)
-- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
+- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的Bug
- 优化 弹出层在超出视窗边缘被遮盖的问题
## 2.0.9(2021-07-07)
- 新增 maskClick 事件
-- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px
+- 修复 特殊情况日历 rpx 布局错误的Bug,rpx -> px
- 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
## 2.0.8(2021-07-07)
- 新增 日期时间显示框支持插槽
## 2.0.7(2021-07-01)
- 优化 添加 uni-icons 依赖
## 2.0.6(2021-05-22)
-- 修复 图标在小程序上不显示的 bug
+- 修复 图标在小程序上不显示的Bug
- 优化 重命名引用组件,避免潜在组件命名冲突
## 2.0.5(2021-05-20)
- 优化 代码目录扁平化
## 2.0.4(2021-05-12)
- 新增 组件示例地址
## 2.0.3(2021-05-10)
-- 修复 ios 下不识别 '-' 日期格式的 bug
+- 修复 ios 下不识别 '-' 日期格式的Bug
- 优化 pc 下弹出层添加边框和阴影
## 2.0.2(2021-05-08)
- 修复 在 admin 中获取弹出层定位错误的bug
@@ -97,7 +167,7 @@
> 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
## 1.0.6(2021-03-18)
- 新增 hide-second 属性,时间支持仅选择时、分
-- 修复 选择跟显示的日期不一样的 bug
-- 修复 chang事件触发2次的 bug
-- 修复 分、秒 end 范围错误的 bug
+- 修复 选择跟显示的日期不一样的Bug
+- 修复 chang事件触发2次的Bug
+- 修复 分、秒 end 范围错误的Bug
- 优化 更好的 nvue 适配
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
index a2201d3..dba9887 100644
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
@@ -13,10 +13,10 @@
'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable,
}">
-
+
{{weeks.date}}
-
+
@@ -41,10 +41,6 @@
return []
}
},
- lunar: {
- type: Boolean,
- default: false
- },
checkHover: {
type: Boolean,
default: false
@@ -83,11 +79,6 @@
color: darken($color: $uni-primary, $amount: 40%);
}
- .uni-calendar-item__weeks-lunar-text {
- font-size: 12px;
- color: #333;
- }
-
.uni-calendar-item__weeks-box-item {
position: relative;
/* #ifndef APP-NVUE */
@@ -116,7 +107,6 @@
}
.uni-calendar-item__weeks-box .uni-calendar-item--disable {
- // background-color: rgba(249, 249, 249, $uni-opacity-disabled);
cursor: default;
}
@@ -124,7 +114,7 @@
color: #D1D1D1;
}
- .uni-calendar-item--isDay {
+ .uni-calendar-item--today {
position: absolute;
top: 10px;
right: 17%;
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
index b376470..0f9e121 100644
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
@@ -1,31 +1,37 @@
-
+
+
+
-
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
index 9acf1ab..024f22f 100644
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
@@ -1,7 +1,7 @@
{
"uni-datetime-picker.selectDate": "select date",
"uni-datetime-picker.selectTime": "select time",
- "uni-datetime-picker.selectDateTime": "select datetime",
+ "uni-datetime-picker.selectDateTime": "select date and time",
"uni-datetime-picker.startDate": "start date",
"uni-datetime-picker.endDate": "end date",
"uni-datetime-picker.startTime": "start time",
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
index b4ba172..1817692 100644
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
@@ -77,21 +77,20 @@
-
-
-
-
diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json
index af8cf5c..00de64a 100644
--- a/uni_modules/uni-easyinput/package.json
+++ b/uni_modules/uni-easyinput/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框",
- "version": "1.1.4",
+ "version": "1.1.22",
"description": "Easyinput 组件是对原生input组件的增强",
"keywords": [
"uni-ui",
@@ -12,12 +12,14 @@
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
- "HBuilderX": ""
+ "HBuilderX": "",
+ "uni-app": "^4.07",
+ "uni-app-x": ""
},
"directories": {
"example": "../../temps/example_temps"
},
-"dcloudext": {
+ "dcloudext": {
"sale": {
"regular": {
"price": "0.00"
@@ -35,51 +37,69 @@
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
- "type": "component-vue"
+ "type": "component-vue",
+ "darkmode": "x",
+ "i18n": "x",
+ "widescreen": "x"
},
"uni_modules": {
"dependencies": [
- "uni-scss",
+ "uni-scss",
"uni-icons"
],
"encrypt": [],
"platforms": {
"cloud": {
- "tcb": "y",
- "aliyun": "y"
+ "tcb": "x",
+ "aliyun": "x",
+ "alipay": "x"
},
"client": {
- "App": {
- "app-vue": "y",
- "app-nvue": "y"
+ "uni-app": {
+ "vue": {
+ "vue2": "√",
+ "vue3": "√"
+ },
+ "web": {
+ "safari": "√",
+ "chrome": "√"
+ },
+ "app": {
+ "vue": "√",
+ "nvue": "-",
+ "android": "√",
+ "ios": "√",
+ "harmony": "√"
+ },
+ "mp": {
+ "weixin": "√",
+ "alipay": "√",
+ "toutiao": "√",
+ "baidu": "√",
+ "kuaishou": "√",
+ "jd": "√",
+ "harmony": "√",
+ "qq": "√",
+ "lark": "-"
+ },
+ "quickapp": {
+ "huawei": "-",
+ "union": "-"
+ }
},
- "H5-mobile": {
- "Safari": "y",
- "Android Browser": "y",
- "微信浏览器(Android)": "y",
- "QQ浏览器(Android)": "y"
- },
- "H5-pc": {
- "Chrome": "y",
- "IE": "y",
- "Edge": "y",
- "Firefox": "y",
- "Safari": "y"
- },
- "小程序": {
- "微信": "y",
- "阿里": "y",
- "百度": "y",
- "字节跳动": "y",
- "QQ": "y"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- },
- "Vue": {
- "vue2": "y",
- "vue3": "y"
+ "uni-app-x": {
+ "web": {
+ "safari": "-",
+ "chrome": "-"
+ },
+ "app": {
+ "android": "-",
+ "ios": "-",
+ "harmony": "-"
+ },
+ "mp": {
+ "weixin": "-"
+ }
}
}
}
diff --git a/uni_modules/uni-fab/changelog.md b/uni_modules/uni-fab/changelog.md
index 0048ff9..8a22807 100644
--- a/uni_modules/uni-fab/changelog.md
+++ b/uni_modules/uni-fab/changelog.md
@@ -1,3 +1,7 @@
+## 1.2.6(2024-10-12)
+- 修复 微信小程序中的getSystemInfo警告
+## 1.2.5(2023-03-29)
+- 新增 pattern.icon 属性,可自定义图标
## 1.2.4(2022-09-07)
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
## 1.2.3(2022-09-05)
diff --git a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue
index 509bd78..492b5d1 100644
--- a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue
+++ b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue
@@ -35,7 +35,7 @@
'uni-fab__circle--rightTop': rightTop,
'uni-fab__content--other-platform': !isAndroidNvue
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
-
@@ -115,7 +115,8 @@
selectedColor: '#007AFF',
backgroundColor: '#fff',
buttonColor: '#007AFF',
- iconColor: '#fff'
+ iconColor: '#fff',
+ icon: 'plusempty'
}
}
},
@@ -163,8 +164,8 @@
},
// 计算 nvue bottom
nvueBottom() {
- const safeBottom = uni.getSystemInfoSync().windowBottom;
// #ifdef APP-NVUE
+ const safeBottom = uni.getSystemInfoSync().windowBottom;
return 30 + safeBottom
// #endif
// #ifndef APP-NVUE
diff --git a/uni_modules/uni-fab/package.json b/uni_modules/uni-fab/package.json
index 6636170..1b8543c 100644
--- a/uni_modules/uni-fab/package.json
+++ b/uni_modules/uni-fab/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-fab",
"displayName": "uni-fab 悬浮按钮",
- "version": "1.2.4",
+ "version": "1.2.6",
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
"keywords": [
"uni-ui",
@@ -43,7 +43,8 @@
"platforms": {
"cloud": {
"tcb": "y",
- "aliyun": "y"
+ "aliyun": "y",
+ "alipay": "n"
},
"client": {
"App": {
diff --git a/uni_modules/uni-file-picker/changelog.md b/uni_modules/uni-file-picker/changelog.md
index 5c81026..f829b7e 100644
--- a/uni_modules/uni-file-picker/changelog.md
+++ b/uni_modules/uni-file-picker/changelog.md
@@ -1,3 +1,29 @@
+## 1.1.2(2025-09-17)
+- 修复 设置readonly属性后内容插槽失效的问题。
+## 1.1.1(2025-09-03)
+- 修复 动态dir目录,不生效的问题
+## 1.1.0(2025-09-02)
+- 新增 dir 属性,可以选择上传目录
+## 1.0.13(2025-08-18)
+- 修复 删除文件后,返回信息不包含file对象的问题
+## 1.0.12(2025-04-14)
+- 修复 支付宝小程序 上传样式问题
+## 1.0.10(2024-07-09)
+- 优化 vue3兼容性
+## 1.0.9(2024-07-09)
+- 修复 value 属性不兼容vue3的bug
+## 1.0.8(2024-03-20)
+- 补充 删除文件时返回文件下标
+## 1.0.7(2024-02-21)
+- 新增 微信小程序选择视频时改用chooseMedia,并返回视频缩略图
+## 1.0.6(2024-01-06)
+- 新增 微信小程序不再调用chooseImage,而是调用chooseMedia
+## 1.0.5(2024-01-03)
+- 新增 上传文件至云存储携带本地文件名称
+## 1.0.4(2023-03-29)
+- 修复 手动上传删除一个文件后不能再上传的bug
+## 1.0.3(2022-12-19)
+- 新增 sourceType 属性, 可以自定义图片和视频选择的来源
## 1.0.2(2022-07-04)
- 修复 在uni-forms下样式不生效的bug
## 1.0.1(2021-11-23)
diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js
index 24a07f5..9c6bcdf 100644
--- a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js
+++ b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js
@@ -7,10 +7,32 @@ function chooseImage(opts) {
const {
count,
sizeType = ['original', 'compressed'],
- sourceType = ['album', 'camera'],
+ sourceType,
extension
} = opts
return new Promise((resolve, reject) => {
+ // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口
+ // #ifdef MP-WEIXIN
+ uni.chooseMedia({
+ count,
+ sizeType,
+ sourceType,
+ mediaType: ['image'],
+ extension,
+ success(res) {
+ res.tempFiles.forEach(item => {
+ item.path = item.tempFilePath;
+ })
+ resolve(normalizeChooseAndUploadFileRes(res, 'image'));
+ },
+ fail(res) {
+ reject({
+ errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL),
+ });
+ },
+ })
+ // #endif
+ // #ifndef MP-WEIXIN
uni.chooseImage({
count,
sizeType,
@@ -25,18 +47,60 @@ function chooseImage(opts) {
});
},
});
+ // #endif
+
});
}
function chooseVideo(opts) {
const {
+ count,
camera,
compressed,
maxDuration,
- sourceType = ['album', 'camera'],
+ sourceType,
extension
} = opts;
return new Promise((resolve, reject) => {
+ // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口
+ // #ifdef MP-WEIXIN
+ uni.chooseMedia({
+ count,
+ compressed,
+ maxDuration,
+ sourceType,
+ extension,
+ mediaType: ['video'],
+ success(res) {
+ const {
+ tempFiles,
+ } = res;
+ resolve(normalizeChooseAndUploadFileRes({
+ errMsg: 'chooseVideo:ok',
+ tempFiles: tempFiles.map(item => {
+ return {
+ name: item.name || '',
+ path: item.tempFilePath,
+ thumbTempFilePath: item.thumbTempFilePath,
+ size:item.size,
+ type: (res.tempFile && res.tempFile.type) || '',
+ width:item.width,
+ height:item.height,
+ duration:item.duration,
+ fileType: 'video',
+ cloudPath: '',
+ }
+ }),
+ }, 'video'));
+ },
+ fail(res) {
+ reject({
+ errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL),
+ });
+ },
+ })
+ // #endif
+ // #ifndef MP-WEIXIN
uni.chooseVideo({
camera,
compressed,
@@ -54,8 +118,7 @@ function chooseVideo(opts) {
resolve(normalizeChooseAndUploadFileRes({
errMsg: 'chooseVideo:ok',
tempFilePaths: [tempFilePath],
- tempFiles: [
- {
+ tempFiles: [{
name: (res.tempFile && res.tempFile.name) || '',
path: tempFilePath,
size,
@@ -74,6 +137,7 @@ function chooseVideo(opts) {
});
},
});
+ // #endif
});
}
@@ -211,8 +275,7 @@ function chooseAndUploadFile(opts = {
}) {
if (opts.type === 'image') {
return uploadFiles(chooseImage(opts), opts);
- }
- else if (opts.type === 'video') {
+ } else if (opts.type === 'video') {
return uploadFiles(chooseVideo(opts), opts);
}
return uploadFiles(chooseAll(opts), opts);
diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
index 0928a41..51f9e21 100644
--- a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
+++ b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
@@ -4,19 +4,13 @@
{{ title }}
{{ filesList.length }}/{{ limitLength }}