1 Star 0 Fork 0

WildPtr / wildh5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

WildH5

DEMO : https://msgjug.com/project/wildh5demo/

项目结构:

  • build/ 打包目标目录
  • css/ CSS
  • DOC/ 文档
  • engine/ 引擎源文件
  • js/ 引擎.JS
  • mods/ 页面(业务逻辑在这里)
  • PSD/ 存放大文件,git忽略此文件夹。
  • index.html 主页
  • main.js JS入口

创建H5页面:

  1. 在index.html里修改ASSET_MAP:
    var ASSET_MAP = {
        INDEX : "mods/index/",
    //  页面名称: "mods/页面路径",
    };
  1. 在项目mods目录下创建文件夹, 在目录下创建一个page.js,在这里写页面逻辑。

页面脚本范例:

    PageScriptLoader.pagePool[ASSET_MAP.INDEX] = function(){
        return {
            name: ASSET_MAP.INDEX,
            onDestroy() {
                //页面退出后摧毁,会被调用。
            },
            onLoad() {
                //页面进入前,会被调用。
                this.page // class Page
                this.page.twidget   // class TWidget
                this.page.div //页面dom
            },
            update(dt) {
                //0.016秒调用一次
            }
        };
    };

打包:

  • compileEngine.bat 打包引擎文件
  • compileMods.bat [srcDir] [dstDir] 打包页面文件,例:
compileMods.bat index index.v1
  • compile.bat 自行修改内容,来打包整个项目。例:
@echo off
set VERSION=%1
call compileEngine.bat && ^
copy index.build.html build\index.html && ^
copy main.js build\main.js && ^
call compileMods.bat index index%VERSION% && ^
echo all ok && ^
exit

执行: compile.bat v2
The MIT License (MIT) Copyright (c) 2019 WildPtr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

H5 库,可以操作DOM。 展开 收起
JavaScript 等 5 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/wildptr/wildh5.git
git@gitee.com:wildptr/wildh5.git
wildptr
wildh5
wildh5
master

搜索帮助