I have been working in an electric power company for two years, and all the applications developed are based on H5 applications. The H5 reference is developed based on the cordova.js library. When various outsourcing companies received the application, they were all confused and did not know how to develop it. This article mainly explains the use of a front-end built based on the seajs library and the Bootstrap framework. Universal framework.
The front-end framework mainly studies four points
1. ResearchThe dynamic loading technology of the Web framework
For In the mobile Internet environment, mobile terminals have limited memory, traffic, and battery resources. By using dynamic loading technology, program files are broken into multiple small files, and lazy loading technology (LazyLoading) is used to achieve on-demand loading to improve user experience. Reduce resource usage on mobile terminal. In terms of business and style, front-end developers only need to reference the required js library and css style at the head of the JS code block. Logically, developers only need to call the interface provided by the backend to read and display. The main advantages of this technology include high maintainability, fast dynamic loading, and good front-end performance optimization.
2. Research on modularizationBuilding technology
Based on the development of mobile application projects by front-end personnel, by using modular construction technology, Each page is divided into multiple functions for segmentation processing, which can not only quickly obtain the page on the mobile terminal, but also quickly locate related problems during debugging on the mobile terminal. By defining multiple modules to call each other, it not only ensures that there is no conflict between modules, but also improves the coding efficiency of developers. Its main advantages are single responsibility and close dependence.
3. Research on multi-resolution and multi-size mobile terminal interface adaptation technology
For various terminal devices on the mobile side, based on the bootstrap framework On the basis of, a unified style is set through the media query function (Medie Query), and equal proportion windows are set through the window (meta) attribute content. This solves the problem of different mobile phone models with different resolutions and different sizes of terminals being unable to adapt. , further reducing code redundancy and redevelopment.
4. Study on the encapsulation of public components on the mobile terminal
Based on the limited encapsulation of some components under the bootstrap framework, through the time plug-in (datatime), pop-up window plug-in (dialog), graphics plug-in (echarts), pull-down refresh and pull-up loading plug-in (Refresh), sliding plug-in (swiper), province and city selection (citypicker) plug-in, prompt information plug-in (UED) ) and other plug-ins are encapsulated, called on demand, and loaded on demand, so that different pages can reference different plug-ins and implement the calling of components, which greatly reduces the time of front-end developers and also improves the user experience.
Here, we will use one of the plug-ins-the pop-up window to explain
Let me show you the renderings first
Pop-up windows are basically used in every application, and there are so many kinds of pop-up windows. Many programmers, here Write one set, write another over there, the code is very messy, here I also found a set on the Internet, and sorted it out myself. I hope everyone will use a common set of codes in the future to make it concise and simple.
Front-end h5 code
The h5 page should be concise and simple, and separate css and js logic codes are not allowed (the following css code is for testing)


nbsp;html> <meta> <meta> <title>首页</title> <meta> <style>.col-xs-6 { padding: 10px 1px; }</style> <div> <div> <div><button>默认的弹窗</button></div> <div><button>success</button></div> <div><button>primary</button></div> <div><button>danger</button></div> <div><button>warning</button></div> <div><button>可设置背景色</button></div> <div><button>自定义标题、描述</button></div> <div><button>点后回调</button></div> <div><button>box-shadow</button></div> <div><button>box-shadow</button></div> <div> <button>box-shadow</button> </div> <div><button>无进入动画</button></div> <div><button>单个按钮</button></div> <div> <button>bootstrap弹窗</button> </div> <div> <button>无标题</button> </div> </div> </div> <script> <div id="dialogContent">这里是用户获取到的内容,获取的内容,可直接设置在这里,然后在页面显示</script>
The above code uses my general framework code. If you use pop-up windows, you can directly quote the dialog. js, dialog.css, jquery.js and dialogtest.js can
dialogtest.js code is as follows
define(function (require) { require("bootstrap");//加载bootstrap require('dialog');//加载弹窗 require('dialogcss');//加载弹窗 var modal = new Modal({ title: '测试案例', content: $('#modal-tpl').html(), width: "90%", onOk: function () { //操作 alert("你点击了确定"); }, onModalShow: function () { //弹窗初始化操作 } }); $(".btn").each(function (index) { $(this).on("click", function () { if(index==0) { $('body').dailog({ type: 'defalut' }); }else if(index==1) { $('body').dailog({ type: 'success' }) } else if (index == 2) { $('body').dailog({ type: 'primary' }) } else if (index == 3) { $('body').dailog({ type: 'danger' }) } else if (index == 4) { $('body').dailog({ type: 'warning' }) } else if (index ==5) { $('body').dailog({ type: 'success', maskBg: 'rgba(33,11,22,0.5)' }) } else if (index ==6) { $('body').dailog({ type: 'danger', title: '我是自定义标题', discription: '这里是自定义的描述,可以写上你的描述或者他的描述,总之可以写很多文字,你自己看着办吧' }, function (ret) { if (ret.index == 0) { alert("你点击了确定按钮"); } else { alert("你点击了取消操作"); } console.log("信息为:"+JSON.stringify(ret)); }) } else if (index ==7) { $('body').dailog({ type: 'danger', title: '错误提示', discription: '这里是自定义的描述,可以写上你的描述或者他的描述,总之可以写很多文字,你自己看着办吧', isInput: true }, function (ret) { console.log(ret); if (ret.index === 0) { alert('你点击的是第' + ret.index + '个按钮,状态:' + ret.input.status + ';输入的值为:' + ret.input.value) }; }); } else if (index == 8) { $('body').dailog({ type: 'defalut', showBoxShadow: true }) } else if (index ==9) { $('body').dailog({ type: 'success', showBoxShadow: true, maskBg: '#fff' }) } else if (index == 10) { $('body').dailog({ type: 'primary', showBoxShadow: true, maskBg: '#ccc' }) } else if (index == 11) { $('body').dailog({ type: 'primary', showBoxShadow: true, animateStyle: 'none' }) } else if (index == 12) { $('body').dailog({ type: 'warning', showBoxShadow: true, animateStyle: 'none', bottons: ['确定'], discription: '也许有点问题!' }) }else if(index==13) { modal.open(); } else if (index == 14) { $('body').dailog({ type: 'defalut',showBoxShadow: true, animateStyle: 'none',isnobutton:false, bottons: ['关闭'], discription: '也许有点问题也许有点问题也许有点问题也许有点问题也许有点问题也许有点问题也许有点问题也许有点问题也许有点问题!' }); } }) }) })
The above is the detailed content of Front-end framework-pop-up window research. For more information, please follow other related articles on the PHP Chinese website!

日历可以帮助用户们记录下你的行程,甚至还可以设置提醒,但是也有不少的用户们在询问win10日历事件提醒不弹出怎么办?用户们可以先检查一下windows更新情况或者是清除windows应用商店缓存来进行操作就可以了。下面就让本站来为用户们来仔细的介绍一下win10日历事件提醒不弹出问题解析吧。添加日历事件在系统菜单中点击“日历”程序。鼠标左键点击日历中的日期。在编辑窗口输入事件名称和提醒时间,点击“保存”按钮即可添加事件了。win10日历事件提醒不弹出问题解决

如何使用Vue实现弹出窗口特效,需要具体代码示例近年来,随着Web应用的发展,弹出窗口特效已经成为广大开发者常用的交互方式之一。Vue作为一款流行的JavaScript框架,提供了丰富的功能和易用性,非常适合用来实现弹出窗口特效。本文将介绍如何使用Vue实现弹出窗口特效,并提供具体代码示例。首先,我们需要使用Vue的CLI工具来创建一个新的Vue项目。打开终

H5是指HTML5,是HTML的最新版本,H5是一个功能强大的标记语言,为开发者提供了更多的选择和创造空间,它的出现推动了Web技术的发展,使得网页的交互和效果更加出色,随着H5技术的逐渐成熟和普及,相信它将会在互联网的世界中发挥越来越重要的作用。

相信在电脑使用过程中,我们都被无意中跳出的弹窗所困扰,尤其是更新系统后,甚至遇到了win11弹窗无法关闭的问题,这时候我们只能在任务管理器里关闭它。win11弹窗无法关闭解决方法:1、首先按下键盘“Win+R”组合键打开运行。2、接着输入“msconfig”回车运行。3、然后进入“启动”,点击“打开任务管理器”4、随后在启动选项下选中弹窗的应用程序。5、最后点击右下角的“禁用”就可以了。

弹窗在360浏览器中是可以自己开启使用到,有些用户并不清楚360浏览器弹窗怎么开启,只要在高级设置中取消勾选不允许任何网站显示弹出式窗口即可,这篇弹窗开启设置方法的介绍就能够告诉大家具体的操作方法,下面就是详细的介绍,赶紧看看吧。360浏览器弹窗怎么开启答:在高级设置中取消勾选不允许任何网站显示弹出式窗口即可详情介绍:1、打开360浏览器,点击右上的【设置】图标。2、选择其中的【选项】。3、点击左侧列表的【高级设置】。4、取消勾选【不允许任何网站显示弹出式窗口】即可。

有时候我们在打开软件、程序的时候,会发现win11用户账号控制一直弹,但是不知道为什么,其实这是系统保护的一种方式,避免我们被不良软件所入侵。win11用户账号控制为什么一直弹:答:因为开启了win11用户账号控制,开启后,系统为了保护电脑安全,防止被不良软件入侵就会一直弹出提醒你。win11用户账号控制一直弹解决方法1、如果我们感觉一直弹特别麻烦,想要关闭。2、那么可以点开底部的“开始菜单”3、接着在其中搜索并打开“更改用户账户控制设置”4、最后将左边滑块移动到“从不通知”并“确定”保存即可解

在使用Win11系统时,有时候打开某个软件会出现弹窗,这会影响用户的使用体验。本文将介绍如何解决Win11打开一个软件就会有弹窗的问题,帮助用户解决这一问题。方法一:1、按【Win+S】组合键,或点击任务栏上开始图标旁边的【搜索图标】,在打开的Windows搜索中,搜索框输入【控制面板】,然后点击打开系统给出的最佳匹配【控制面板应用】;2、所有控制面板项窗口,切换到【大图标】查看方式,然后找到并点击调整计算机的设置下的【安全和维护】;3、安全和维护窗口,左侧点击【更改用户账户控制设置】;4、用户


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools