parent
1b3a1fed98
commit
889cd97e64
@ -1,5 +1,5 @@
|
||||
<view>
|
||||
<view class="brand_tu">
|
||||
<c-echars showChart="{{showChart}}" canvasId="chart-canvas" chartId="chartbar" chartOption="{{brandOption}}" height="100%"></c-echars>
|
||||
<c-echars showChart="{{showChart}}" canvasId="chart-canvas" chartId="chartbar" chartOption="{{brandOption}}" height="100%"></c-echars>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,19 @@
|
||||
export function doStr(str, n) {
|
||||
let totalCount = 0;
|
||||
let txt = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
let c = str.charCodeAt(i);
|
||||
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
|
||||
totalCount++;
|
||||
} else {
|
||||
totalCount += 2;
|
||||
}
|
||||
if (totalCount <= n) {
|
||||
txt += str[i];
|
||||
} else {
|
||||
txt += '...';
|
||||
return txt
|
||||
}
|
||||
}
|
||||
return txt;
|
||||
}
|
Loading…
Reference in new issue