更新记录
0.0.4(2023-05-22)
0.0.3(2023-05-15)
0.0.2(2023-05-08)
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.1.0 app-vue app-nvue |
× |
√ |
√ |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
√ |
√ |
√ |
√ |
√ |
× |
× |
× |
× |
lime-image 图片 加强版
- 对内置image组件加强功能
- 基于uniapp vue3
- Q群 1169785031
说明
本插件在原来的image组件上,增加如下功能:
- UI加载状态:加载中,加载失败
- vue3 nvue 支持svg,不支持vue2 nvue,因vue2 nvue不支持TS
安装
- 在市场导入插件即可在任意页面使用,无须再
import
使用
// mode
<l-image mode="widthFix" src="https://picsum.photos/200/300?random=lime" />
状态
// 自定义加载状态
<l-image mode="widthFix" src="https://picsum.photos/200/300?random=lime">
<template #loading>
<text>加载中</text>
</template>
<template #error>
<text>加载失败</text>
</template>
</l-image>
形状
- shape: 有round,circle,square
// 自定义加载状态
<l-image shape="round" src="https://picsum.photos/200/300?random=lime"></l-image>
查看示例
// 代码位于 uni_modules/lime-image/compoents/lime-image
<lime-image />
插件标签
- 默认 l-image 为 component
- 默认 lime-image 为 demo
关于vue2的使用方式
- 插件使用了
composition-api
, 如果你希望在vue2中使用请按官方的教程vue-composition-api配置
- 关键代码是: 在main.js中 在vue2部分加上这一段即可,官方是把它单独成了一个文件.
// vue2
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
另外插件也用到了TS,vue2可能会遇过官方的TS版本过低的问题,找到HX目录下的compile-typescript
目录
// \HBuilderX\plugins\compile-typescript
yarn add typescript -D
- or -
npm install typescript -D
API
Props
参数 |
说明 |
类型 |
默认值 |
src |
图片地址 |
string |
`` |
mode |
图片裁剪、缩放的模式,同原版 |
string |
`` |
shape |
图片形状:square ,round ,circle |
string |
square |
parentId |
父级ID,用于inject 时的name |
string |
`` |
injectId |
子级ID,用于inject 时父级收集子级的name |
string |
`` |
widht |
宽度 |
number |
`` |
height |
高度 |
number |
`` |
Events
参数 |
说明 |
参数 |
load |
加载成功 |
{details} |
error |
加载失败 |
{error} |
Expose
参数 |
说明 |
参数 |
image |
暴露image实例 ,主要用于类似h5 img的功能 |
|
打赏
如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。