开始使用 API对象 布局容器和栅格系统 Color 色彩 Button 按钮 Tag 标签 Badge 数字角标 List 列表 Grid 宫格 Card 卡片 Noticebar 通告 Steps 步骤条 Icon 图标 Srarch 搜索 侧滑菜单 图片上传 图片预览 图片裁剪 图片主色 星级评价 选择器 下拉选择 选项卡 生成二维码 复制剪贴板 物流信息 加入购物车 波浪特效 水球图 倒计时 雪花飘落 loading动画 toast消息提示弹窗 dialog提示窗 actionsheet操作表 actionmenu分享弹窗 popover菜单 picker多级联动 poster广告弹窗 keypad数字键盘 chatbox js聊天输入框

水球图

需要先引入相关的CSS和JS文件:

<link rel="stylesheet" type="text/css" href="static/css/aui.min.css"/>

<script src="static/js/aui.min.js" type="text/javascript" charset="utf-8"></script>

<script src="lib/jquery/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>

<script src="lib/waterbubble/waterbubble.js" type="text/javascript" charset="utf-8"></script>

示例代码

<style>
    body{background: #FFF;}
    .waterbubble-warp{width: 100%; min-height: 265px; text-align: center;}
    #dowebok{margin: 30px auto;}
    .aui-lists{z-index: 1;}
    .aui-list{width: 50%; display: inline-block; vertical-align: top;}
    .aui-list:last-child::after{display: inline-block;}
    .aui-list.col-before::before{height: 60%; top: 20%;}
    .aui-list-right .aui-btn-right{font-size: 20px;}
    .aui-list.active .aui-list-right .aui-btn-right{color: var(--aui-color);}
</style>
<div id="app" class="container">
    <header class="aui-header">
        <a onclick="aui.closeWin()" class="aui-header-left">
            <i class="iconfont iconreturn"></i>
        </a>
        <div class="aui-header-title">水球图</div>
    </header>
    <div class="aui-content">
        <div class="waterbubble-warp">
            <canvas id="dowebok" width="408" height="408" style="width: 204.167px; height: 204.167px;"></canvas>
        </div>
        <div class="aui-lists row-before" data-id="0">
            <div class="aui-list active">
                <div class="aui-list-left">默认效果</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio"></i>
                </div>
            </div>
            <div class="aui-list col-before" data-id="1">
                <div class="aui-list-left">水球半径</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list"  data-id="2">
                <div class="aui-list-left">边框宽度</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list col-before" data-id="3">
                <div class="aui-list-left">数据多少</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list" data-id="4">
                <div class="aui-list-left">水球颜色</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list col-before" data-id="5">
                <div class="aui-list-left">显示文本</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list" data-id="6">
                <div class="aui-list-left">文本颜色</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list col-before" data-id="7">
                <div class="aui-list-left">设置字体</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list" data-id="8">
                <div class="aui-list-left">是否显示波纹</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
            <div class="aui-list col-before" data-id="9">
                <div class="aui-list-left">是否显示动画</div>
                <div class="aui-list-right">
                    <i class="iconfont aui-btn-right iconradio1"></i>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function (){
        $('#dowebok').waterbubble();
        $('.aui-list').click({
            var id = $(this).data('id');
            $('.waterbubble-warp').html('<canvas id="dowebok"></canvas>');
            switch (id){
                case 0: //默认效果
                    $('#dowebok').waterbubble();
                    break;
                case 1: //水球半径
                    $('#dowebok').waterbubble({
                        radius: 50
                    });
                    break;
                case 2: //边框宽度
                    $('#dowebok').waterbubble({
                        lineWidth: 1
                    });
                    break;
                case 3: //数据多少
                    $('#dowebok').waterbubble({
                        data: 0.8
                    });
                    break;
                case 4: //水球颜色
                    $('#dowebok').waterbubble({
                        waterColor: '#FF5555'
                    });
                    break;
                case 5: //显示文本
                    $('#dowebok').waterbubble({
                        data: 0.8,
                        txt: '80%'
                    });
                    break;
                case 6: //文本颜色
                    $('#dowebok').waterbubble({
                        data: 0.8,
                        txt: '80%',
                        textColor: '#FFF'
                    });
                    break;
                case 7: //设置字体
                    $('#dowebok').waterbubble({
                        txt: 'dowebok',
                        font: 'bold 25px arial'
                    });
                    break;
                case 8: //是否显示波纹
                    $('#dowebok').waterbubble({
                        wave: false
                    });
                    break;
                case 9: //是否显示动画
                    $('#dowebok').waterbubble({
                        animation: false
                    });
                    break;
                default:
                    break;
            }
        })
    })
</script>