Okam(奥卡姆):小程序开发框架
Okam(奥卡姆):小程序开发框架
Okam 是什么
`Okam` 一个面向小程序开发的开发框架,开发体验类 `Vue`。详情
Okam 对各小程序的支持情况
- 支持 百度小程序
- 支持 微信小程序
- 支持 支付宝小程序
Okam 提供了什么
- 开发模式
- 支持单文件组件化开发方式,目录结构更加清晰简洁
- 支持 NPM 包的依赖管理和引用
- 提供渐进增强可配置方式,包括可配置的构建流程,来提升开发框架能力
- 开发语法
- 模板:支持类 `Vue` 模板语法、`Pug` 模板语法
- 样式:支持 CSS 预处理器和后处理器, `Stylus`、`Less`、`Sass`、`Postcss`
- 脚本:支持 `Typescript`、`ES Next` 语法支持
- 扩展的能力
- `HTML` 标签支持
- Vue` 数据操作语法,包括 `computed`、`watch` 支持
- `Redux` 数据状态管理
- 模板组件 `ref` 引用支持
- `Mixins` 支持
- `Promise`、`Async`、`await` 语法支持
- 原生接口支持可定制的 `Promise` 化
- 提供原生接口 `Hook` 能力
- 样式 `rpx` 单位自动转换
- 接口 `Mock`
- 图片自动压缩能力
- 其它
- 框架 `API` 优化及扩展、数据操作优化
- 微信请求优化
- 原生小程序和开发框架语法混用支持
代码示例
- 入口脚本
/**
* @file 小程序入口
* @author <author>
*/ 'use strict'; export default {
config: {
pages: [
'pages/home/index'
], window: {
navigationBarBackgroundColor: '#211E2E',
navigationBarTextStyle: 'white',
backgroundTextStyle: 'light',
enablePullDownRefresh: true,
backgroundColor: '#ccc'
}, networkTimeout: {
request: 30000
}
}, $promisifyApis: []
};
- 入口样式
/**
* @file The app entry style
* @author <author>
*/ @require './common/css/mixin.styl'
@require './common/css/variable.styl'
@require './common/css/common.styl'
- 页面
<template>
<view class="home-wrap">
<hello :from="from" @hello="handleHello"></hello>
<view class="click-tip" if="clicked">You click me~</view>
</view>
</template>
<script>
import Hello from '../../components/Hello'; export default {
config: {
title: 'Page Title'
}, components: {
Hello
}, data: {
btnText: 'Hello',
clicked: false,
from: 'HomePage'
}, methods: { handleHello(e) {
this.clicked = true;
this.btnText = 'You clicked'; this.$api.showToast({
title: 'Received Hello',
duration: 3000
});
}
}
};
</script>
<style lang="stylus">
@require '../../common/css/variable.styl'
@require '../../common/css/mixin.styl' .home-wrap
padding: 100px
height: 100vh
box-sizing: border-box
background: #ddd .click-tip
margin-top: 100px
padding: 20px
text-align: center
color: red </style>
- 组件
<template>
<view class="hello-wrap">
<button plain class="hello-btn" @click="handleClick">Hello in {{from}}</button>
</view>
</template>
<script>
export default {
config: {
}, props: {
from: String
}, components: {
}, data: {
}, methods: {
handleClick() {
this.$emit('hello', {from: this.from});
}
}
};
</script>
<style lang="stylus">
.hello-wrap
padding: 20px
margin: 20px 0 .hello-btn
width: 846px
height: 148px
margin: 0 auto
line-height: @height
background: #fff
text-align: center
border-radius: 120px
border: none
</style>
操作步骤:
git clone https://github.com/ecomfe/okam-template.git cd okam-template npm i npm run dev // 百度小程序开发模式 npm run dev:wx // 微信小程序开发模式 开发工具 打开 构建产物目录 `dist、wx_dist`
更多详细信息
技术交流
技术交流:QQ 群:`728460911`,入群备注:okam
技术学习:项目代码开源在 Github 上,有问题或者建议,欢迎提 issue, 发 pr。
Okam(奥卡姆):小程序开发框架的更多相关文章
- 微信小程序开发框架技术选型
目前微信小程序开发有三种方式,原生微信小程序,使用mpVue或wepy微信小程序开发框架. 三种开发方式横向对比资料如下:
- 微信小程序开发框架整理
目前除了原生的微信小程序开发外,各大厂商陆续造了自己的开发框架,现整理如下: WePY 腾讯官方开源的小程序组件化开发框架,目前有15K+Star ,一直在更新着,社区活跃,掉坑能快速的找到方法爬出来 ...
- [原创] 分享我们自己搭建的微信小程序开发框架——wframe及设计思想详解
wframe不是控件库,也不是UI库,她是一个微信小程序面向对象编程框架,代码只有几百行.她的主要功能是规范小程序项目的文件结构.规范应用程序初始化.规范页面加载及授权管理的框架,当然,wframe也 ...
- wepy - 小程序开发框架
2017-09-23 运行命令. wepy build --watch 2017-11-06 wepy一直用的1.5.8,同事有一次安装了最新的1.6.0就报错了... unexpected char ...
- 小程序开发框架----WXSS
规定了屏幕宽度为750个RPX,从而可以通过屏幕宽度来进行自适应
- 微信小程序开发框架 Wepy 的使用
一.github地址:https://github.com/Tencent/wepy 按照 README.md 的步骤进行操作: 1.在“介绍”中获得 wepy 的开发资源汇总:https://git ...
- 【腾讯Bugly干货分享】打造“微信小程序”组件化开发框架
本文来自于腾讯Bugly公众号(weixinBugly),未经作者同意,请勿转载,原文地址:http://mp.weixin.qq.com/s/2nQzsuqq7Avgs8wsRizUhw 作者:Gc ...
- 微信小程序开发(五)开发框架MINA
微信团队为小程序提供的框架命名为MINA应用框架.MINA框架通过封装微信客户端提供的文件系统.网络通信.任务管理.数据安全等基础功能,对上层提供一整套JavaScript API,让开发者能够非常方 ...
- 微信小程序-03-小程序开发框架
微信小程序-03-小程序开发框架 官方文档: https://developers.weixin.qq.com/miniprogram/dev/framework/MINA.html 小程序开发框架 ...
随机推荐
- PHP扩展插件 imagick 、PDO_MYSQL 安装
环境准备 echo $LC_ALL echo "export LC_ALL=C" >> /etc/profile source /etc/profile yum ins ...
- day41 - 异步IO、协程
目录 (见右侧目录栏导航) - 1. 前言- 2. IO的五种模型- 3. 协程 - 3.1 协程的概念- 4. Gevent 模块 - 4.1 gevent 基本使用 - 4.2 ...
- Nginx1.8.1 编译扩展https
nginx无缝编译扩展https 本贴只限用于通过编译安装的nginx,如果用的是yum源安装请卸载后参见 http://www.cnblogs.com/rslai/p/7851220.html 安装 ...
- MyBatis3-与Spring MVC 4集成
继前一篇的例子http://www.cnblogs.com/EasonJim/p/7052388.html,已经集成了Spring框架,现在将改造成Spring MVC的项目,并实现如下功能: 1.不 ...
- 结构体对齐及#pragma详细解释
在linux下c语言结构体对齐: 1.自然对齐 struct 是一种复合数据类型,其构成元素既可以是基本数据类型(如int.long.float 等)的变量,也可以是一些复合数据类型(如array.s ...
- booklist for machine learning
Recommended Books Here is a list of books which I have read and feel it is worth recommending to fri ...
- 1-4 TCP/IP协议族
网络协议是在内核中实现的,socket是对tcp/ip协议的系统调用,提供以下两点功能: 1. 将应用撑血数据从用户缓冲区中复制到TCP/UDP内核发送缓冲区,以交付内核发送来的数据(比如send), ...
- JavaScript中变量、作用域、内存问题
这几天,闲的没事看看JavaScript高级编程,感觉JavaScript真的很强大,尤其是采用面向对象的编程方式. 一. 基本类型和引用类型的值: ECMAScript变量可能包含两种不同数据类 ...
- 第一个ajax小demo
第一个ajax小demo 文章来源:http://blog.csdn.net/magi1201/article/details/44569657
- LaTeX算法排版 笔记
方式一 需要包含的 \usepackage[noend]{algpseudocode} \usepackage{algorithmicx,algorithm} 源码 \begin{algorithm} ...