app.js和app.wpy有什么不同呢?

答.app.wpy单文件包含了app.wxss\app.js\app.json\app.wxml

app.js

 App({

   /**
* 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
*/
onLaunch: function () { }, /**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function (options) { }, /**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function () { }, /**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function (msg) { }
})

app.wpy

 <style lang="less">
@import './font/iconfont.less';
page {
height: 100%;
background-color: #fff;
}
</style> <script>
import wepy from 'wepy';
import 'wepy-async-function'; export default class extends wepy.app {
config = {
pages: [
'pages/ep/ep',
'pages/forexpress',
'pages/bill/addone',
'pages/plan',
'pages/plan/clock',
'pages/bill',
'pages/me',
'pages/me/about',
'pages/me/planT',
'pages/me/billT',
'pages/index/index',
'pages/expressJump/expressJump',
'pages/share/share',
'pages/me/edit',
'pages/weather',
'pages/historytoday',
'pages/game/index',
'pages/testYun/index'
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#138cff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'white',
backgroundColor: '#138cff'
},
tabBar: {
color: '#757982',
selectedColor: '#138cff',
borderStyle: 'white',
backgroundColor: '#fff',
list: [
{
pagePath: 'pages/plan',
text: '计划',
iconPath: 'images/tabbar/plan.png',
selectedIconPath: 'images/tabbar/plan-on.png'
},
{
pagePath: 'pages/bill',
text: '账本',
iconPath: 'images/tabbar/bill.png',
selectedIconPath: 'images/tabbar/bill-on.png'
},
{
pagePath: 'pages/forexpress',
text: '快递',
iconPath: 'images/tabbar/index.png',
selectedIconPath: 'images/tabbar/index-on.png'
},
{
pagePath: 'pages/weather',
text: '天气',
iconPath: 'images/tabbar/weather.png',
selectedIconPath: 'images/tabbar/weather-on.png'
},
{
pagePath: 'pages/me',
text: '我的',
iconPath: 'images/tabbar/me.png',
selectedIconPath: 'images/tabbar/me-on.png'
}
]
}
}; globalData = {
userInfo: null,
info: {
name: 11
}
}; constructor() {
super();
this.use('requestfix');
this.use('promisify');
} onLaunch() {
this.testAsync();
Date.prototype.getWeek = function(days) {
let week = [
'星期天',
'星期一',
'星期二',
'星期三',
'星期四',
'星期五',
'星期六'
];
return week[new Date(this).getDay()];
};
} sleep(s) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('promise resolved....');
}, s * 1000);
});
} async testAsync() {
const data = await this.sleep(3);
console.log('打印数据:', data);
} getUserInfo(cb) {}
}
</script>

wepy - 与原生有什么不同(app.js和app.wpy比较)的更多相关文章

  1. App.js和App.css(用于移动应用的js和css)

    App.js和App.css(用于移动应用的js和css) 一.App.js和App.css(用于移动应用的js和css) App.js 是一个轻量级的 JavaScript UI 库,用来创建移动的 ...

  2. webpack中mainifest.js vendor.js app.js 三者的区别

    场景: 大家在利用构建工具进行应用最后的打包过程中,我们希望做到的是将业务代码和第三方引用模块代码分开打包. 因为第三方引用模块代码通常很大,而且在不引入新的模块之前基本上是不会变动的.所以我们需要将 ...

  3. 微信小程序 --- app.js文件

    app.js文件是项目的入口文件: //app.js App({ onLaunch: function () { // 展示本地存储能力 var logs = wx.getStorageSync('l ...

  4. 完整且易读的最新版小程序登录态和检验注册过没的app.js写法

    目录 0.可参考的官方页面 1.流程 2.app.js代码 3.java后台怎么通过code获取openId 0.可参考的官方页面 获取登录凭证:https://developers.weixin.q ...

  5. express 应用创建及app.js详解

    #1 express 应用创建 1.安装node.js (自行百度) 2.npm install express -g 3.全局安装express生成器 express-generator npm i ...

  6. 通过const app = getApp()实现在 page 页面获取 app.js 定义的属性globalData,即获取全局数据

    App.js是项目的入口文件,页面的 page.js 文件会覆盖 app.js文件, App.js文件里面的一些方法: onLaunch : function(){}:这个方法是当小程序加载完毕后就执 ...

  7. Sencha Touch app example -- oreilly app 分析

    from: 2013/8/30的笔记 使用development.js 读取 app.json 配置文件 app.json 配置了app.js文件 app.js lauch function ,首先用 ...

  8. 【微信小程序项目实践总结】30分钟从陌生到熟悉 web app 、native app、hybrid app比较 30分钟ES6从陌生到熟悉 【原创】浅谈内存泄露 HTML5 五子棋 - JS/Canvas 游戏 meta 详解,html5 meta 标签日常设置 C#中回滚TransactionScope的使用方法和原理

    [微信小程序项目实践总结]30分钟从陌生到熟悉 前言 我们之前对小程序做了基本学习: 1. 微信小程序开发07-列表页面怎么做 2. 微信小程序开发06-一个业务页面的完成 3. 微信小程序开发05- ...

  9. App.js – 用于移动 Web App 开发的 JS 界面库

    App.js 是一个轻量级的 JavaScript UI 库,用于创建像本地应用程序的移动 Web 应用而不牺牲性能和体验.它是跨平台的,特定的UI设计,配置类似原生的过渡效果.App.js 的目的是 ...

随机推荐

  1. NSAttributedString描述

    字符属性 字符属性可以应用于 attributed string 的文本中. NSString *const NSFontAttributeName;(字体) NSString *const NSPa ...

  2. MYSQL-5.5.37-win32.msi 这个版本得程序包谁有吗 可以给我一下吗?

    之前下载了这个版本得mysql   但是跟服务器链接不上   后来我就卸载了  但由于卸载不干净  现在又删了注册表   好像把这个程序包得什么文件删除了  现在提示配置文件错误  所以有这个程序包得 ...

  3. 虚拟信用卡 全球付, 工商银行国际E卡, Bancore, Entropay, Payoneer

    虚拟信用卡 海外网购.购买国外域名空间.ebay等一些国外网站账号的激活这些情况都需要用到国际信用卡, 如果没有信用卡或者有信用卡但是对于安全性有所顾虑怎么办? 其实有一种东西叫做虚拟信用卡,正规银行 ...

  4. ldd pvs dis on solaris 10

    #include <QtGui/QApplication> #include <QtGui/QDialog> int main(int argc, char *argv[]) ...

  5. 报错:无法从int?转换为int

    □ 背景分析 在控制器方法中的一个参数允许为null值:public ActionResult GetByCategory(int? categoryId = null) 当把这里的categoryI ...

  6. [self removeAllSubviews]; // 删除所有子视图(包括 selfl.view) 所以,要慎用

    [self removeAllSubviews];  //删除所有子视图(包括 selfl.view)   所以,要慎用

  7. ActiveX控件开发

    VC2005从开发MFC ActiveX ocx控件到发布到.net网站的全部过程 开篇语:最近在弄ocx控件发布到asp.net网站上使用,就是用户在使用过程中,自动下载安装ocx控件.(此文章也是 ...

  8. Java遍历Map键、值。获取Map大小的方法

    Map读取键值对,Java遍历Map的两种实现方法 第一种方法是根据map的keyset()方法来获取key的set集合,然后遍历map取得value的值 import java.util.HashM ...

  9. 《Windows核心编程》第3章——handle复制相关实验

    先写一个程序,用来查看进程的内核对象,这样我们就能比较子进程是否继承了父进程的某个句柄: #include <windows.h> #include <stdio.h> #de ...

  10. JBoss 系列一 O O:Maven jBPM 6 集成演示样例

    概述 jBPM 6 中底层架构基于 Maven,所以我们能够非常easy的进行 Maven jBPM 6 集成演示样例,本文分三个部分: 基本原理介绍 Maven jBPM 6 集成 jBPM 6 中 ...