微信公眾號開發weui使用心得

PHPz
發布: 2017-03-18 18:01:08
原創
4989 人瀏覽過

微信公眾號開發weui使用心得,避免少犯錯!

特別注意:

如果使用 jquery,則 jquery.js 一定要放在 的最後面,否則 weui 不起作用。

引用部分weui

只需要載入weui.css 即可

{% load staticfiles %}
<link rel="stylesheet" href="{% static "joyroost/css/weui.css" %}"/>
登入後複製

引用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 最後寫上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 結構

<script type="text/html" id="tpl_home">
<div class="page">
    <div class="page__hd">
    <div class="page__bd">
    <div class="page__ft">
登入後複製

注意事項:

如果page 的上面不寫id="tpl_home" 就會報錯

<script type="text/html" id="tpl_home">
    <div class="page">
登入後複製

報錯如下:

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)
登入後複製

下面是在chromium 中報錯圖:

 chromium 中报错图

來自簡書swotpp

#

以上是微信公眾號開發weui使用心得的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!