HTML
CSS
JavaScript
HTML
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Snackbar - 带回调的 Snackbar</title>
  <link rel="stylesheet" href="https://cdn.w3cbus.com/library/mdui/1.0.2/css/mdui.min.css"/>
</head>
<body class="mdui-theme-accent-pink">

  <div class="mdui-container">
    <button class="mdui-btn mdui-color-theme-accent" id="open">open</button>
  </div>

  <script src="https://cdn.w3cbus.com/library/mdui/1.0.2/js/mdui.min.js"></script>
</body>
</html>
CSS

  
JavaScript
var $ = mdui.$;

$('#open').on('click', function () {
  mdui.snackbar({
    message: 'Archived',
    buttonText: 'undo',
    onClick: function () {
      mdui.alert('点击了 Sanckbar');
    },
    onButtonClick: function () {
      mdui.alert('点击了按钮');
    },
    onClose: function () {
      mdui.alert('关闭了');
    }
  });
});