# 便捷工具(facile)

数据缓存方法。

# 基本使用

# 获取图片主题色

获取图片的主题色,兼容H5、APP、微信小程序三端

    <canvas class="image-theme-color" canvas-id="canvasId"></canvas>
    <style>
        .image-theme-color{
            position: fixed;
            margin-left: -1000rpx;
        }
    </style>
    const color = await this.$itu.getImageThemeColor({ canvasId: 'canvasId', path: url });

提示

url为图片地址,H5需要同源才行

# 判断是否微信环境

this.$itu.isWechat()

# 判断是否企业微信环境

this.$itu.isWxWork()

# 判断是否为空

this.$itu.isEmpty(value)

# 延时操作

进行延时,以达到可以简写代码的目的 比如: await this.$itu.sleep(20)将会阻塞20ms

# value:堵塞时间 单位ms 毫秒
this.$itu.sleep(value)
上次更新: 10/17/2024, 8:28:04 PM