thinkphp5框架新建页面相关规范详解
2022-07-28 14:14:58
134
{{single.collect_count}}

本应用基于ThinkPHP的MVC(模型-试图-控制器)的方式来组织。在新建页面时必须遵循该设计模式。

以下以移动端首页为例,新建页面步骤:

移动端首页文件路径:

application->wap->view->first->index->index.html

模板渲染:

application->wap->controller->Index.php->index()

index.html结构:

在这里插入图片描述

JavaScript模块:
页面JavaScript模块化遵循AMD规范,基于RequireJS实践。

新建JavaScript模块文件路径:

public->wap->first->zsff->js

在js文件夹下新建js文件(一个js文件即是一个JavaScript模块)。

模块写法:

在这里插入图片描述

引入模块:

在这里插入图片描述

Vue使用方法:

模块路径定义:

application->wap->view->first->public->requirejs.html

在这里插入图片描述

页面引入Vue:

提示:模块是先定义,再引用,再使用!!!

在这里插入图片描述

Vue组件:基于RequireJS、css.js和text.js配合,实现Vue组件的使用。

在requirejs.html配置css.js和text.js:

在这里插入图片描述

新建Vue组件,组件文件路径:

public->wap->first->zsff->components

在components文件下新建组件,可参考源码中payment组件。

在这里插入图片描述

如果大家还有不懂的可以在下方留言,我们会给你详细的解答

最后
如果你觉得这篇文章对你有点用的话,麻烦请给我们的开源项目点点star:http://github.crmeb.net/u/defu不胜感激 !

免费获取源码地址:http://www.crmeb.com

PHP学习手册:https://doc.crmeb.com

技术交流论坛:https://q.crmeb.com

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}