Code Monkey home page Code Monkey logo

wepy-demo's Introduction

wepy框架开发Demo

原包体积: 306KB

整体概览:

  • 组件:wepy组件
  • 模板:wxml
  • 样式:postcss + postcss-plugin
  • 逻辑层:npm + es2015 + decorator
  • 网络请求:wx.request + interceptor
  • 数据流:redux + redux-thunk
  • 子系统:component + sdk
  • 动画:待补充

移除wepy-async-function包的引用

小程序环境已原生支持Promiseregenerator-runtime并不常用,包会导致在微信开发者工具调试环境下报错,因为在严格模式下this关键字被禁止指向全局对象。

解决lodash资源包重复拷贝的问题

依赖关系:redux-promise require flux-standard-action require lodash.xxx

redux-promise替换为更常用的redux-thunk

移除默认引入的redux-actions

采纳redux-actionscreateActionshandleActions写法

运行环境导致的异常和常量定义

引用wepy-plugin-replace处理npm包或源码中运行环境相关的代码

集成postcss编译环节,less暂时移除

添加cssnext并将运行环境设置为ios 9android 4.4,据主流OS的发布和占比更改

添加工作区IDE配置以完全适配wepy组件编译环节

目前仅支持vscode

tabSize : 2
endWithNewline : true
html.validate.styles : false
javascript.implicitProjectConfig.experimentalDecorators : true

开发&调试

1.进入项目目录,使用npm i安装依赖

2.使用npm run dev开启实时编译

3.打开微信开发者工具,导入项目,项目地址为${workspace}\\dist,如果编译结果正常,直接展示编译后的项目首页

4.修改文件并保存,wepy实时编译生效,微信开发者工具自动同步编译并重新进入项目首页

5.本地调试:在微信开发者工具的控制台中调试
远程真机调试:点击工具栏中的远程调试,等待二维码生成,使用真机上的微信扫描二维码

处理后的包体积: 175KB

wepy的坑

wpy组件文件需要以空行结束

空的style不生成wxss文件导致微信开发者工具报错

wepy-demo's People

Watchers

Drakes-0 avatar

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.