Code Monkey home page Code Monkey logo

szushudong's Introduction

深大的树洞 2.0

本仓库是深大的树洞微信小程序对应的开源仓库,旨在分享微信小程序的开发经验。

本仓库依赖于 Wepy 框架,感谢 Wepy 作者的努力。

同时,请注意本仓库的开源协议为 GPL,这意味着你拥有运行、复制、修改、发行和传播该软件的自由,但是你修改后的软件本身也受 GPL 约束,你必须开放源代码。

如果阅读源码对于程序的架构设计有问题,可以先看一下我写的深大的树洞 2.0 开发记录,有对设计的细节进行详细的阐述。

开发环境运行

# 全局安装 wepy
npm install wepy-cli -g

# 安装依赖
npm i

# 启动实时编译
wepy build --watch

开发使用说明

  1. 使用微信开发者工具新建项目,本地开发选择 dist 目录。
  2. **【重要】**微信开发者工具 --> 项目 --> 关闭 ES6 转 ES5。
  3. 本地项目根目录运行 wepy build --watch,开启实时编译。

代码高亮

VS Code

在插件目录搜索安装 vetur,点击 VS Code 右下角的语言,选择 “.wpy” 的配置文件关联,然后选择 Vue,即可启动代码高亮。

Sublime Text
  1. 打开 Sublime->Preferences->Browse Packages.. 进入用户包文件夹。
  2. 在此文件夹下打开 cmd,运行 git clone [email protected]:vuejs/vue-syntax-highlight.git,无 GIT 用户可以直接下载 zip 包解压至当前文件夹。
  3. 关闭 .wpy 文件重新打开即可高亮。
WebStorm
  1. 打开 Preferences,搜索 Plugins,搜索 Vue.js 插件并安装。
  2. 打开 Preferences,搜索 File Types,找到 Vue.js Template,在 Registered Patterns 添加 *.wpy,即可高亮。

问题

对于小程序的 API 使用问题请查看微信官方小程序文档Wepy 官方文档

如果是对于树洞本身的一些 BUGs 或问题,请提 issue

开源协议

查看 LICENSE

Copyright (c) 2016-present, Junyi (Jason) Chen

szushudong's People

Contributors

jas0ncn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

szushudong's Issues

wepy build --watch 时报错

`/Users/norton/HomesteadSyncDir/szushudong/src/components/clist.wpy
221:20 error Redundant Boolean call no-extra-boolean-cast

✖ 1 problem (1 error, 0 warnings)

[11:51:24] [编译] 页面: src/pages/detail.wpy

/Users/norton/HomesteadSyncDir/szushudong/src/pages/detail.wpy
452:20 error Redundant Boolean call no-extra-boolean-cast

✖ 1 problem (1 error, 0 warnings)`

pages/index.wpy: [vue-language-server] The template root requires exactly one element.

发现了一个小错误

<template>
    <view class="container">
        <view class="page page-list {{ tab === 0 ? 'visible' : 'hide' }}">
            <list></list>
        </view>
        <view class="page {{ tab === 1 ? 'visible' : 'hide' }}">
            <message></message>
        </view>
        <view class="page {{ tab === 2 ? 'visible' : 'hide' }}">
            <user></user>
        </view>
    </view>
    <view class="tabs" wx:if="{{ showTabs }}">
        <view class="tab" @tap="switchTapTo(0)">
            <image src="../assets/svgs/home-fill.svg" wx:if="{{ tab === 0 }}"></image>
            <image src="../assets/svgs/home.svg" wx:else></image>
        </view>
        <view class="tab" @tap="switchTapTo(1)">
            <image src="../assets/svgs/message-fill.svg" wx:if="{{ tab === 1 }}"></image>
            <image src="../assets/svgs/message.svg" wx:else></image>
            <view class="badge badge-number" wx:if="{{ unreadMessagesCount !== 0 }}">{{ unreadMessagesCount }}</view>
        </view>
        <view class="tab" @tap="switchTapTo(2)">
            <image src="../assets/svgs/my-fill.svg" wx:if="{{ tab === 2 }}"></image>
            <image src="../assets/svgs/my.svg" wx:else></image>
        </view>
    </view>
</template>

修改为

<template>
    <view class="container">
        <view class="page page-list {{ tab === 0 ? 'visible' : 'hide' }}">
            <list></list>
        </view>
        <view class="page {{ tab === 1 ? 'visible' : 'hide' }}">
            <message></message>
        </view>
        <view class="page {{ tab === 2 ? 'visible' : 'hide' }}">
            <user></user>
        </view>
        <view class="tabs" wx:if="{{ showTabs }}">
            <view class="tab" @tap="switchTapTo(0)">
                <image src="../assets/svgs/home-fill.svg" wx:if="{{ tab === 0 }}"></image>
                <image src="../assets/svgs/home.svg" wx:else></image>
            </view>
            <view class="tab" @tap="switchTapTo(1)">
                <image src="../assets/svgs/message-fill.svg" wx:if="{{ tab === 1 }}"></image>
                <image src="../assets/svgs/message.svg" wx:else></image>
                <view class="badge badge-number" wx:if="{{ unreadMessagesCount !== 0 }}">{{ unreadMessagesCount }}</view>
            </view>
            <view class="tab" @tap="switchTapTo(2)">
                <image src="../assets/svgs/my-fill.svg" wx:if="{{ tab === 2 }}"></image>
                <image src="../assets/svgs/my.svg" wx:else></image>
            </view>
        </view>
    </view>
</template>

目前发现的问题,和改进建议

遇到的问题:
image
出现这个报错同时,首页list blog刷新后不渲染
image
忽略了错误,变成了警告,不知道有没有影响
改进建议:
1.不同时获取code和用户信息,使用code得到openid,自己服务器返回openid,参考小程序最新登陆流程
image
2.blog暴露openid可能出现安全问题

初学nodejs,望指教,谢谢

请问project.config.json这个文件是直接修改值为false么,小程序无法正确运行

F:\qianduan_dir\00program\wechat\szushudong-master\src\components\clist.wpy
151:9 error Unexpected console statement no-console
202:9 error Unexpected console statement no-console
221:20 error Redundant Boolean call no-extra-boolean-cast

✖ 3 problems (3 errors, 0 warnings)

[22:56:20] [编译] 页面: src\pages\detail.wpy

F:\qianduan_dir\00program\wechat\szushudong-master\src\pages\detail.wpy
210:9 error Unexpected console statement no-console
250:19 error Empty block statement no-empty
275:7 error Unexpected console statement no-console
292:19 error Empty block statement no-empty
312:30 error 'idx' is defined but never used no-unused-vars
452:20 error Redundant Boolean call no-extra-boolean-cast

✖ 6 problems (6 errors, 0 warnings)

小程序无法正常运行呢

错误提示:

VM167:1 thirdScriptError
sdk uncaught third Error
Cannot read property 'Promise' of undefined
TypeError: Cannot read property 'Promise' of undefined
at http://127.0.0.1:61136/appservice/npm/wepy-async-function/index.js:14:7
at require (http://127.0.0.1:61136/appservice/__dev__/WAService.js:22:26841)
at http://127.0.0.1:61136/appservice/__dev__/WAService.js:22:26448
at http://127.0.0.1:61136/appservice/app.js:13:1
at require (http://127.0.0.1:61136/appservice/__dev__/WAService.js:22:26841)
at :1:1
at HTMLScriptElement.scriptLoaded (http://127.0.0.1:61136/appservice/appservice?t=1537279701514:1690:23)

学习交流

你好,能否给一个 key 访问您的 API?学习用。谢谢哦

我的微信访问
https://sd.iszu.cn/user/wxlogin
结果是这样的。能帮忙一下吗。
data
:
{}
errcode
:
11
errmsg
:
"ERR_SESSION_KEY_EXCHANGE_FAILED"

Async/Await Q

我在用 wepy 框架开发小程序时,wpy 文件中使用await 编译后页面运行报错。出现脚本错误或者未正确调用 Page(), 应该是不识别,怎么配置支持 await 写法呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.