WeChat public account development weui usage experience

PHPz
Release: 2017-03-18 18:01:08
Original
5036 people have browsed it

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" %}"/>
Copy after login

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>
Copy after login

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>
Copy after login

weui structure

<script type="text/html" id="tpl_home">
<div class="page">
    <div class="page__hd">
    <div class="page__bd">
    <div class="page__ft">
Copy after login

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">
Copy after login

The error will be reported as follows:

Uncaught TypeError: Cannot set property &#39;url&#39; of undefined
at setPageManager (example.js:264)
at init (example.js:289)
at example.js:296
at HTMLDocument.<anonymous> (zepto.min.js:1)
Copy after login

The following is an error message in chromium:

 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!