yu-mobile-tool

Tools for mobile page

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
yu-mobile-tool
1.0.24 years ago4 years agoMinified + gzip package size for yu-mobile-tool in KB

Readme

Yu Mobile Tool 移动端常用工具库

版本

npm package NPM downloads

引入

使用 npm 或 yarn 安装

$ npm install yu-mobile-tool --save
或者
$ yarn add yu-mobile-tool
import YuMobileTool from 'yu-mobile-tool'
import 'yu-mobile-tool/dist/style.css'

浏览器引入

<script src="~filepath/yu-mobile-tool.min.js"></script>
<link rel="stylesheet" href="~filepath/style.css">

使用

Toast 文本提示

YuMobileTool.Toast(message, duration)

参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 | | :----------: | :------: | :--: | :----: | :--------------: | | message | String | 是 | 无 | 信息文本 | | duration | Number | 否 | 1500 | 显示时长(毫秒) |

使用 npm 或 yarn

import YuMobileTool from 'yu-mobile-tool'
const spin = YuMobileTool.Toast('操作成功', 2000)

浏览器引入

<script>
    YuMobileTool.Toast('操作成功', 2000)
</script>

Spin 加载效果

const spin = new YuMobileTool.Spin(target, options).show()

参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 | | :----------: | :------: | :--: | :----: | :--------------: | | target | String/DOM | 是 | 无 | 目标节点 | | options | Object | 否 | transparent: true | spin的配置 |

使用 npm 或 yarn

import YuMobileTool from 'yu-mobile-tool'
const spin = new YuMobileTool.Spin('#app', {
    transparent: false,
    show: false
})
spin.show()
spin.hide()

浏览器引入

<div class="test-box"></div>
<script>
    const spin = new YuMobileTool.Spin('.test-box')
    spin.show()
    setTimeout(() => {
        spin.hide()
    }, 3000)
</script>