WeChat public account development weui usage experience to avoid making fewer mistakes!
Special note:
If you use jquery, jquery.js must be placed at the end of
, otherwise weui will not work.Quoting part of weui
You only need to load weui.css
{% load staticfiles %} <link rel="stylesheet" href="{% static "joyroost/css/weui.css" %}"/>
Quoting the entire example framework of weui
head link css <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> <title>WeUI</title> {% load staticfiles %} <link rel="stylesheet" href="{% static "joyroost/css/weui.css" %}"/> <link rel="stylesheet" href="{% static "joyroost/css/example.css" %}"/> </head>
body Finally write js
<script src="{% static "joyroost/js/weui/zepto.min.js" %}"></script> <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script> <script src="{% static "joyroost/js/weui/example.js" %}"></script>
weui structure
<script type="text/html" id="tpl_home"> <div class="page"> <div class="page__hd"> <div class="page__bd"> <div class="page__ft">
Notes:
If id="tpl_home" is not written on the page, an error will be reported
<script type="text/html" id="tpl_home"> <div class="page">
The error will be reported as follows:
Uncaught TypeError: Cannot set property 'url' of undefined at setPageManager (example.js:264) at init (example.js:289) at example.js:296 at HTMLDocument.<anonymous> (zepto.min.js:1)
The following is an error message in chromium:
from Jianshu swotpp
The above is the detailed content of WeChat public account development weui usage experience. For more information, please follow other related articles on the PHP Chinese website!