16HUI - 多功能菜单(hui.actionSheet)

简介: 16HUI - 多功能菜单(hui.actionSheet)

效果图

核心函数hui.actionSheet(meuns, cancel, callback)

功能:弹出一个多功能菜单

参数:

1、数组形式的菜单

2、取消按钮名称

3、点击对应菜单后执行的回调函数

代码

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI - 操作表</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>HUI - 操作表</h1>
</header>
<div class="hui-wrap">
    <div class="hui-common-title" style="margin-top:15px;">
        <div class="hui-common-title-line"></div>
        <div class="hui-common-title-txt">操作表演示</div>
        <div class="hui-common-title-line"></div>
    </div>
    <div style="padding:20px; padding-top:38px;">
        <button type="button" class="hui-button hui-button-large" id="btn1">Action Sheet</button>
        <button type="button" class="hui-button hui-button-large" id="btn2" style="margin-top:18px;">H5+ 原生 Action Sheet</button>
   </div>
</div>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var meuns = ['拍照', '从相册中选择'];
var cancel = '取消';
hui('#btn1').click(function(){
    hui.actionSheet(meuns, cancel, function(e){
        console.log(e.index);
        hui.toast(e.innerHTML);
    });
});
//手册地址
//http://www.html5plus.org/doc/zh_cn/nativeui.html#plus.nativeUI.actionSheet
hui('#btn2').click(function(){
    if(!window.plus){
        hui.alert('只能在h5+环境下运行!');
        return false;
    }
    var actionbuttons = [{title : "微信好友"}, {title : "朋友圈"}];
    var actionstyle   = {title : "请选择分享类型", cancel : "取消", buttons : actionbuttons};
    plus.nativeUI.actionSheet(actionstyle, function(e){
        console.log(e.index);
    });
});
</script>
</body>
</html>
目录
相关文章
15HUI - Loading动画(hui.loading)
15HUI - Loading动画(hui.loading)
57 0
15HUI - Loading动画(hui.loading)
07HUI - 普通列表(hui-list)
07HUI - 普通列表(hui-list)
50 0
|
JavaScript
10HUI - 按钮(hui-button)
10HUI - 按钮(hui-button)
73 0
03HUI -基础文本(hui-common-title)
03HUI -基础文本(hui-common-title)
59 0
17HUI - 进度条(hui-progress)
17HUI - 进度条(hui-progress)
47 0
17HUI - 进度条(hui-progress)
11HUI - 数字标识(hui-badge)
11HUI - 数字标识(hui-badge)
54 0
11HUI - 数字标识(hui-badge)
13HUI - 模态对话框(hui.alert、hui.confirm)
13HUI - 模态对话框(hui.alert、hui.confirm)
83 0
14HUI - 全屏消息(hui.blackMask)
14HUI - 全屏消息(hui.blackMask)
52 0
|
JavaScript
20HUI - 折叠面板(hui-accordion)
20HUI - 折叠面板(hui-accordion)
61 0
|
JavaScript
20HUI - 标签组件(hui-tags)
20HUI - 标签组件(hui-tags)
63 0