iakit
v2.2.0
La bibliothèque mini-composants sans dépendance encapsule uniquement les composants plus fréquemment utilisés, tels que l'alerte, le toast, le chargement, la feuille d'action. Un projet mobile simple comme H5 Active Pages n'a pas à introduire une bibliothèque et un cadre d'interface utilisateur larges et complets pour utiliser ces composants.
iakit.aler ![]() | iakit.loading ![]() | iakit.ActionSheet ![]() | iakit. ![]() |
Installé à l'aide de fils / npm, introduit de manière modulaire
$ yarn add iakit
import * as iakit from 'iakit'
import 'iakit/dist/style.css'
iakit . alert ( '提示' , '测试测试测试测试' )
iakit . loading . show ( )
iakit . actionsheet ( { /* 你的选项 */ } )
iakit . toast . showTop ( '测试测试测试' )Vous pouvez également importer directement des fichiers, tels que l'utilisation de CDN
< link rel =" stylesheet " href =" https://unpkg.com/[email protected]/dist/style.css " >
< script src =" https://unpkg.com/[email protected]/dist/index.js " > </ script >
< script >
iakit . alert ( '提示' , '测试测试测试测试' )
iakit . loading . show ( )
iakit . actionsheet ( { /* 你的选项 */ } )
iakit . toast . showTop ( '测试测试测试' )
</ script > iakit.alert(title, content, buttons)string , facultatifstring , requisearray | function , facultatif (structure du bouton: {texte: chaîne, onclick: fonction}) import * as iakit from 'iakit'
// demo 1.
iakit . alert ( '注册失败' , '该邮箱已经被注册,如果有您有任何疑问请咨询客服。' )
// demo 2.
iakit . alert (
'注册失败' ,
'该邮箱已经被注册,如果有您有任何疑问请咨询客服。' ,
[
{ text : '取消' , onClick : ( ) => { } } ,
{ text : '确定' , onClick : ( ) => { } }
]
) z-index : Lorsqu'il y a d'autres éléments sur la page et que la hiérarchie est relativement élevée, vous pouvez utiliser ce paramètre pour ajuster le niveau d'alerte.btnText : La copie du bouton par défaut est "OK", qui peut être modifiée via ce paramètre iakit . alert . config ( {
zIndex : 9999 , // alert 的 z-index
btnText : 'ok' // 默认按钮的文案
} )iakit.toast.showTop(content, time, callback)string requisenumber affiche le nombre de millisecondes, facultatif, par défaut est 1500function toast le rappel disparu, facultatif import * as iakit from 'iakit'
// demo 1.
iakit . toast . showTop ( '注册成功' )
// demo 2.
iakit . toast . showCenter ( '注册成功' , 5000 )
// demo 3.
iakit . toast . showBottom ( '注册成功' , ( ) => {
// do something you want
} )iakit.loading.show() import * as iakit from 'iakit'
iakit . loading . show ( )
setTimeout ( ( ) => {
iakit . oading . hide ( )
} , 3000 )iakit.actionsheet(options) string , facultatifarray , requise (structure d'option: {texte: chaîne, désactiver: booléen, onclick: fonction})number , facultatif import * as iakit from 'iakit'
iakit . actionsheet ( {
options : [
{
text : '我再想想' ,
disable : false ,
onClick : ( i , text ) => { }
} ,
{
text : '去它的(disabled)' ,
disable : true
} ,
{
text : '就这样吧' ,
onClick : ( i , text ) => {
}
}
] ,
destructiveIndex : 2 ,
title : '确认要分手吗?' ,
onClick ( i , text ) {
// 点击了没有指定 onClick 函数的选项时,执行这个函数
} ,
onCancel ( ) {
// 取消了
}
} ) Mit