当前位置: 首页 > 工具软件 > jQuery WeUI > 使用案例 >

weui和jquery weui关系

黎鹤轩
2023-12-01

这个是自己写了一个测试的jquery weui
刚开始很困惑,link引入了weui和jquery-weui,这两个是什么关系呢?为什么引入这两个css库呢?
通过查找,找到些眉目了, jquery weui == weui + jquery插件; jquery-weui是官方weui的升级版本,扩展了官方的weui。jquery-weui是官方weui的jquery版本。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>weui</title>
    <link rel="stylesheet" href="css/weui.min.css" />
    <link rel="stylesheet" href="css/jquery-weui.min.css" />
</head>
<body>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">姓名</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" value="" placeholder="请输入姓名" id="name">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label" id="gender">性别</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" value="" placeholder="">
            </div>
        </div>
    </div>
    <div style="margin: 10px;">
        <a  class="weui-btn weui-btn_primary" onclick="clicking()">按钮</a>
        <a href="javascript:;" class="weui-btn weui-btn_disabled weui-btn_primary">按钮</a>
        <a href="javascript:;" class="weui-btn weui-btn_warn">确认</a>
        <a href="javascript:;" class="weui-btn weui-btn_disabled weui-btn_warn">确认</a>
        <a href="javascript:;" class="weui-btn weui-btn_default">按钮</a>
        <a href="javascript:;" class="weui-btn weui-btn_disabled weui-btn_default">按钮</a>
        <a href="javascript:;" class="weui-btn weui-btn_plain-default">按钮</a>
        <a href="javascript:;" class="weui-btn weui-btn_plain-primary">按钮</a>
    </div>


</body>
<script type="text/javascript" src="jslib/jquery-2.1.4.js" ></script>
<script type="text/javascript" src="jslib/fastclick.js" ></script>
<script>
  $(function() {
    FastClick.attach(document.body);
  });
</script>
<script type="text/javascript" src="jslib/jquery-weui.min.js" ></script>
<script type="text/javascript">

    $(function(){
        var name = $("#name").val();
        console.log(name);
        //
    });
   function clicking(){
      $.alert("自定义的消息内容", function() {
          console.log("1111111111111111111");
        });
   }
</script>
</html>
 类似资料: