Home  >  Article  >  WeChat Applet  >  WeChat public account development weui usage experience

WeChat public account development weui usage experience

PHPz
PHPzOriginal
2017-03-18 18:01:085051browse

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 6c04bd5ca3fcae76e30b72ad730ca86d, 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 &#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)

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!

Statement:
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