![]() |
hai 1 ano | |
---|---|---|
.. | ||
addUnit | hai 1 ano | |
arrayBufferToFile | hai 1 ano | |
base64ToArrayBuffer | hai 1 ano | |
base64ToPath | hai 1 ano | |
camelCase | hai 1 ano | |
canIUseCanvas2d | hai 1 ano | |
clamp | hai 1 ano | |
cloneDeep | hai 1 ano | |
closest | hai 1 ano | |
createAnimation | hai 1 ano | |
createImage | hai 1 ano | |
debounce | hai 1 ano | |
exif | hai 1 ano | |
fillZero | hai 1 ano | |
floatAdd | hai 1 ano | |
getClassStr | hai 1 ano | |
getCurrentPage | hai 1 ano | |
getLocalFilePath | hai 1 ano | |
getRect | hai 1 ano | |
getStyleStr | hai 1 ano | |
hasOwn | hai 1 ano | |
isBase64 | hai 1 ano | |
isBrowser | hai 1 ano | |
isDef | hai 1 ano | |
isFunction | hai 1 ano | |
isNumber | hai 1 ano | |
isNumeric | hai 1 ano | |
isObject | hai 1 ano | |
isPromise | hai 1 ano | |
isString | hai 1 ano | |
kebabCase | hai 1 ano | |
pathToBase64 | hai 1 ano | |
piexif | hai 1 ano | |
platform | hai 1 ano | |
raf | hai 1 ano | |
random | hai 1 ano | |
range | hai 1 ano | |
selectComponent | hai 1 ano | |
sleep | hai 1 ano | |
throttle | hai 1 ano | |
toArray | hai 1 ano | |
toNumber | hai 1 ano | |
unitConvert | hai 1 ano | |
useIntersectionObserver | hai 1 ano | |
vue | hai 1 ano | |
changelog.md | hai 1 ano | |
index.ts | hai 1 ano | |
package.json | hai 1 ano | |
readme.md | hai 1 ano |
// 按需引入
// 这种只会引入相关的方法
import {getRect} from '@/uni_modules/lime-shared/getRect'
// 全量引入
// 这种引入方式,会全量打包
import {getRect} from '@/uni_modules/lime-shared'
// 组件内需要传入上下文
// 如果是nvue 则需要在节点上加与id或class同名的ref
getRect('#id',{context: this}).then(res => {})
addUnit(10)
// 10px
unitConvert('10rpx')
// 5 设备不同 返回的值也不同
unitConvert('10px')
// 10
unitConvert(10)
// 10
canIUseCanvas2d()
// 若支持返回 true 否则 false
const page = getCurrentPage()
base64ToPath(`xxxxx`).then(res => {})
pathToBase64(`xxxxx/xxx.png`).then(res => {})
async next () => {
await sleep(300)
console.log('limeui');
}
isBase64('xxxxx')
throttle((nama) => {console.log(nama)}, 200)('limeui');
debounce((nama) => {console.log(nama)}, 200)('limeui');
random(1, 5);
range(0, 5)
// [0,1,2,3,4,5]
clamp(0, 10, -1)
// 0
clamp(0, 10, 11)
// 10
clamp(0, 10, 9)
// 9
floatAdd(0.1, 0.2) // 0.3
个位数
则在前面补0fillZero(9);
// 09
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)
})
}
})
// 当前页面
const page = getCurrentPage()
selectComponent('.custom', {context: page}).then(res => {
})
<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)
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'
<div class="target">
<h1>Hello world</h1>
</div>
// options 接口可传的参数,若在插件里context为必传
interface UseIntersectionObserverOptions {
root ?: string; // 观察器的根元素选择器字符串
rootMargin ?: {
top ?: number; // 根元素顶部边距
bottom ?: number; // 根元素底部边距
left ?: number; // 根元素左侧边距
right ?: number; // 根元素右侧边距
}; // 根元素的边距
thresholds ?: any[]; // 交叉比例数组,用于指定何时触发回调函数
context ?: any; // 上下文对象,用于指定观察器的上下文
initialRatio ?: number; // 初始的交叉比例
observeAll ?: boolean; // 是否同时观察所有交叉对象
}
const options: UseIntersectionObserverOptions = {
rootMargin: {top: 44},
context: this
}
const {stop} = useIntersectionObserver('.target', (result) => {
}, options)