|
hace 1 día | |
---|---|---|
.. | ||
addUnit | hace 1 día | |
animation | hace 1 día | |
areaData | hace 1 día | |
arrayBufferToFile | hace 1 día | |
base64ToArrayBuffer | hace 1 día | |
base64ToPath | hace 1 día | |
camelCase | hace 1 día | |
canIUseCanvas2d | hace 1 día | |
capitalizedAmount | hace 1 día | |
characterLimit | hace 1 día | |
clamp | hace 1 día | |
cloneDeep | hace 1 día | |
closest | hace 1 día | |
components | hace 1 día | |
createAnimation | hace 1 día | |
createCanvas | hace 1 día | |
createImage | hace 1 día | |
debounce | hace 1 día | |
exif | hace 1 día | |
fillZero | hace 1 día | |
floatAdd | hace 1 día | |
floatDiv | hace 1 día | |
floatMul | hace 1 día | |
floatSub | hace 1 día | |
getClassStr | hace 1 día | |
getCurrentPage | hace 1 día | |
getLocalFilePath | hace 1 día | |
getRect | hace 1 día | |
getStyleStr | hace 1 día | |
guid | hace 1 día | |
hasOwn | hace 1 día | |
isBase64 | hace 1 día | |
isBoolean | hace 1 día | |
isBrowser | hace 1 día | |
isByteLength | hace 1 día | |
isDate | hace 1 día | |
isDef | hace 1 día | |
isEmail | hace 1 día | |
isEmpty | hace 1 día | |
isFunction | hace 1 día | |
isIP | hace 1 día | |
isNumber | hace 1 día | |
isNumeric | hace 1 día | |
isObject | hace 1 día | |
isPromise | hace 1 día | |
isRegExp | hace 1 día | |
isString | hace 1 día | |
isURL | hace 1 día | |
isValidDomain | hace 1 día | |
kebabCase | hace 1 día | |
merge | hace 1 día | |
obj2url | hace 1 día | |
pathToBase64 | hace 1 día | |
platform | hace 1 día | |
raf | hace 1 día | |
random | hace 1 día | |
range | hace 1 día | |
selectAllComponent | hace 1 día | |
selectComponent | hace 1 día | |
selectElement | hace 1 día | |
shuffle | hace 1 día | |
sleep | hace 1 día | |
throttle | hace 1 día | |
toArray | hace 1 día | |
toBoolean | hace 1 día | |
toNumber | hace 1 día | |
unitConvert | hace 1 día | |
vue | hace 1 día | |
while | hace 1 día | |
changelog.md | hace 1 día | |
index.ts | hace 1 día | |
package.json | hace 1 día | |
readme.md | hace 1 día |
在插件市场导入即可
按需引入只会引入相关的方法,不要看着 插件函数列表多 而占空间,只要不引用不会被打包
import {getRect} from '@/uni_modules/lime-shared/getRect'
// 组件内需要传入上下文
// 如果是nvue 则需要在节点上加与id或class同名的ref
getRect('#id',this).then(res => {})
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
addUnit(10)
// 10px
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
unitConvert('10rpx')
// 5 设备不同 返回的值也不同
unitConvert('10px')
// 10
unitConvert(10)
// 10
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
canIUseCanvas2d()
// 若支持返回 true 否则 false
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
const page = getCurrentPage()
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
base64ToPath(`xxxxx`).then(res => {})
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
pathToBase64(`xxxxx/xxx.png`).then(res => {})
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
async next () => {
await sleep(300)
console.log('limeui');
}
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
throttle((nama) => {console.log(nama)}, 200)('limeui');
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
debounce((nama) => {console.log(nama)}, 200)('limeui');
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
random(1, 5);
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
range(0, 5)
// [0,1,2,3,4,5]
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
clamp(0, 10, -1)
// 0
clamp(0, 10, 11)
// 10
clamp(0, 10, 9)
// 9
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
floatAdd(0.1, 0.2) // 0.3
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
个位数
则在前面补0fillZero(9);
// 09
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
uni.chooseImage({
count: 1, //最多可以选择的图片张数
sizeType: "original",
success: (res) => {
exif.getData(res.tempFiles[0], function() {
let tagj = exif.getTag(this, "GPSLongitude");
let Orientation = exif.getTag(this, 'Orientation');
console.log(tagj, Orientation)
})
}
})
| uni-app | uni-app x | |------------|----------------------------------| | √ | x |
// 当前页面
const page = getCurrentPage()
selectComponent('.custom', {context: page}).then(res => {
})
| uni-app | uni-app x | |------------|----------------------------------| | √ | x |
<view ref="ball" :animation="animationData"></view>
const ball = ref(null)
const animation = createAnimation({
transformOrigin: "50% 50%",
duration: 1000,
timingFunction: "ease",
delay: 0
})
animation.scale(2,2).rotate(45).step()
// nvue 无导出数据,这样写只为了平台一致,
// nvue 需要把 ref 传入,其它平台不需要
const animationData = animation.export(ball.value)
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
camelCase("hello world") // helloWorld
camelCase("hello world", true) // HelloWorld
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
kebabCase("helloWorld") // hello-world
kebabCase("hello world_example") // hello-world-example
kebabCase("helloWorld", "_") // hello_world
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
closest([1, 3, 5, 7, 9], 6) // 5
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
shuffle([1, 3, 5, 7, 9])
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
const original = { color: 'red' };
const merged = merge({ ...original }, { color: 'blue', size: 'M' });
console.log('original', original); // 输出: { color: 'red' } (保持不变)
console.log('merged', merged); // 输出: { color: 'red', size: 'M' }
type ColorType = {
color?: string,
size?: string,
}
const merged2 = merge({ color: 'red' } as ColorType, { color: 'blue', size: 'M' } as ColorType);
console.log('merged2', merged2)
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
isBase64('xxxxx')
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
isNumber('0') // false
isNumber(0) // true
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
isNumeric('0') // true
isNumeric(0) // true
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
isString('0') // true
isString(0) // false
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
console.log(isIP('192.168.1.1')); // true
console.log(isIP('2001:0db8:85a3:0000:0000:8a2e:0370:7334')); // true
console.log(isIP('192.168.1.1', 4)); // true
console.log(isIP('255.255.255.255', { version: 4 })); // true
// 标准IPv6格式
console.log(isIP('2001:0db8:85a3:0000:0000:8a2e:0370:7334', 6)); // true
console.log(isIP('fe80::1%eth0', { version: 6 })); // true(带区域标识)
| uni-app | uni-app x | |------------|----------------------------------| | √ | √ |
vue2需要在main.js加上这一段
// vue2
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
//使用
import {computed, onMounted, watch, reactive} from '@/uni_modules/lime-shared/vue'
| uni-app | uni-app x | |------------|----------------------------------| | √ | x |