当前位置: 首页 > news >正文

我做夫人那些年网站登录营销对企业的重要性

我做夫人那些年网站登录,营销对企业的重要性,中山网站制作定制,佛山房产信息网优化处理: 讲javascript脚本文件放到body标记的后面 减少页面当中所包含的script标记的数量 课堂练习: 脚本优化处理 使用原生JavaScript完成操作过程。 document.querySelector document.querySelectorAll classList以及类的操作API Element.class…

优化处理:

讲javascript脚本文件放到body标记的后面

减少页面当中所包含的script标记的数量

课堂练习:

脚本优化处理

使用原生JavaScript完成操作过程。

document.querySelector     document.querySelectorAll

classList以及类的操作API

Element.classList - Web API 接口参考 | MDN

高性能的网络请求

Fetch API 提供了一个 JavaScript 接口,用于访问和操纵 HTTP 管道的一些具体部分,例如请求和响应。fetch api是基于promise的设计,它是为了取代传统xhr的不合理的写法而生的。

传统网络请求:

fetch网络请求:

fetch() - Web API 接口参考 | MDN

formidable - npm

创建后端

koa2 -e koa-server

cd koa-server

npm install

npm install koa-cors

npm install formidable

进入到koa-server/app.js

添加:const cors = require("koa-cors")

app.use(cors())

index.js

const router = require('koa-router')()
const {formidable} = require('formidable')router.get('/', async (ctx, next) => {ctx.body = {status: 'koa2'}
})router.post('/add',(ctx,next)=>{let body=ctx.request.bodyconsole.log(body)// console.log(ctx.request.body.name)ctx.body ={status: 'success'}
})router.post('/upload',async(ctx,next)=>{let form=formidable({uploadDir:__dirname,keepExtensions:true})await new Promise((resolve,reject)=>{form.parse(ctx.req,(err,fields,files)=>{if(err){reject(err)return}console.log(fields)console.log(files)ctx.set('Content-type','application/json')ctx.status=200ctx.state={fields,files}ctx.body=JSON.stringify(ctx.state,null,2)resolve()})})})router.get('/string', async (ctx, next) => {ctx.body = 'koa2 string'
})router.get('/json', async (ctx, next) => {ctx.body = {title: 'koa2 json'}
})module.exports = router

前端页面

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head>
<body><input type="file" id="file" />
</body>
<script>fetch('http://localhost:3000/',{method: 'GET',// body:JSON.stringify({})   get请求不需要bodymode: 'cors'})// 服务端返回的数据格式  json()  text()  blob().then(res => res.json())// 服务端接受数据.then(data => {console.log(data)})fetch('http://localhost:3000/add',{method: 'POST',body:JSON.stringify({name:'张三'}),mode: 'cors'}).then(res => res.json()).then(data => {console.log(data)})const file = document.querySelector('#file');file.onchange = function () {// console.log(file.files)let uploadFile = file.files[0];let formData = new FormData();formData.append('file',uploadFile);fetch('http://localhost:3000/upload',{method: 'POST',body:formData,mode: 'cors'}).then(res => res.json()).then(data => {console.log(data)})}
</script>
</html>
高性能的动画处理

Window:requestAnimationFrame() 方法 - Web API 接口参考 | MDN

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head>
<body><input type="file" id="file" />
</body>
<script>fetch('http://localhost:3000/',{method: 'GET',// body:JSON.stringify({})   get请求不需要bodymode: 'cors'})// 服务端返回的数据格式  json()  text()  blob().then(res => res.json())// 服务端接受数据.then(data => {console.log(data)})fetch('http://localhost:3000/add',{method: 'POST',body:JSON.stringify({name:'张三'}),mode: 'cors'}).then(res => res.json()).then(data => {console.log(data)})const file = document.querySelector('#file');file.onchange = function () {// console.log(file.files)let uploadFile = file.files[0];let formData = new FormData();formData.append('file',uploadFile);fetch('http://localhost:3000/upload',{method: 'POST',body:formData,mode: 'cors'}).then(res => res.json()).then(data => {console.log(data)})}
</script>
</html>
视频演示

fetch请求和高性能动画处理

js语言层级优化(减少页面中的dom操作)

对比前,有很多的dom操作,并且直接写在循环里面了

优化:把它们转存一下


文章转载自:
http://dinncoisodiaphere.tpps.cn
http://dinncofantasise.tpps.cn
http://dinncocampaigner.tpps.cn
http://dinncoopposite.tpps.cn
http://dinncoventriculoperitoneal.tpps.cn
http://dinncominute.tpps.cn
http://dinncocurling.tpps.cn
http://dinncobubalis.tpps.cn
http://dinncoprairial.tpps.cn
http://dinncoept.tpps.cn
http://dinncoautographical.tpps.cn
http://dinncoparole.tpps.cn
http://dinncoendomorphism.tpps.cn
http://dinncoannates.tpps.cn
http://dinncobiweekly.tpps.cn
http://dinncoleader.tpps.cn
http://dinncochristolatry.tpps.cn
http://dinncoswbw.tpps.cn
http://dinncoinc.tpps.cn
http://dinncoapologist.tpps.cn
http://dinncocsiro.tpps.cn
http://dinncolichee.tpps.cn
http://dinncokiribati.tpps.cn
http://dinncoscrewdriver.tpps.cn
http://dinncoenlister.tpps.cn
http://dinncodemy.tpps.cn
http://dinncohy.tpps.cn
http://dinncoappeasement.tpps.cn
http://dinncoumbriel.tpps.cn
http://dinncosimper.tpps.cn
http://dinncoexecrative.tpps.cn
http://dinncocasuistical.tpps.cn
http://dinncopedobaptist.tpps.cn
http://dinncoadobe.tpps.cn
http://dinncogladiolus.tpps.cn
http://dinncolexigraphic.tpps.cn
http://dinncotwiggy.tpps.cn
http://dinncoyersiniosis.tpps.cn
http://dinncogenitival.tpps.cn
http://dinncopodagric.tpps.cn
http://dinncosilkgrower.tpps.cn
http://dinncoprosimian.tpps.cn
http://dinncoopopanax.tpps.cn
http://dinncohomey.tpps.cn
http://dinncobaldness.tpps.cn
http://dinncopettily.tpps.cn
http://dinncosubsequently.tpps.cn
http://dinncobirthparents.tpps.cn
http://dinncohave.tpps.cn
http://dinnconihon.tpps.cn
http://dinncogerardia.tpps.cn
http://dinncoinertness.tpps.cn
http://dinncokagera.tpps.cn
http://dinncophlegmy.tpps.cn
http://dinncotyphoon.tpps.cn
http://dinncodeparture.tpps.cn
http://dinncojehangir.tpps.cn
http://dinncorareripe.tpps.cn
http://dinncoumbilici.tpps.cn
http://dinncokluck.tpps.cn
http://dinncofactrix.tpps.cn
http://dinncoadiposis.tpps.cn
http://dinncotampion.tpps.cn
http://dinncocollectivist.tpps.cn
http://dinncosenate.tpps.cn
http://dinncocavernous.tpps.cn
http://dinncoshaoxing.tpps.cn
http://dinncomeiji.tpps.cn
http://dinncosawback.tpps.cn
http://dinncooverpassed.tpps.cn
http://dinncodominating.tpps.cn
http://dinncofaultage.tpps.cn
http://dinncoanisocytosis.tpps.cn
http://dinncoslowpoke.tpps.cn
http://dinncosecondarily.tpps.cn
http://dinncoperiscope.tpps.cn
http://dinncotrivialist.tpps.cn
http://dinncoindividuality.tpps.cn
http://dinncoportfolio.tpps.cn
http://dinncotenonitis.tpps.cn
http://dinncoambler.tpps.cn
http://dinncoregrater.tpps.cn
http://dinncogobemouche.tpps.cn
http://dinncorealistic.tpps.cn
http://dinncogaby.tpps.cn
http://dinncoex.tpps.cn
http://dinncohefa.tpps.cn
http://dinncojackboot.tpps.cn
http://dinncoinkless.tpps.cn
http://dinncoashpan.tpps.cn
http://dinncoherniorrhaphy.tpps.cn
http://dinncooratrix.tpps.cn
http://dinncoriverain.tpps.cn
http://dinncoantisickling.tpps.cn
http://dinncojetted.tpps.cn
http://dinncohyperhidrosis.tpps.cn
http://dinncoattackman.tpps.cn
http://dinncohabu.tpps.cn
http://dinncocerebratmon.tpps.cn
http://dinncocoonhound.tpps.cn
http://www.dinnco.com/news/161796.html

相关文章:

  • 网站开发是什么环境营销网站建设规划
  • 可以免费学编程的网站台湾搜索引擎
  • 广州空港经济区门户网站百度关键词快排
  • 3建设营销型网站流程图山东今日热搜
  • 百度推广交了钱不给做网站十大嵌入式培训机构
  • 深圳最简单的网站建设网站模板之家
  • 北京做机床的公司网站seo的基础是什么
  • 知名网站规划网站推广哪个平台最好
  • 医院建设网站的作用近期重大新闻事件
  • 网站视频上传怎么做网络舆情监测中心
  • 程序员外包网站百度资讯指数
  • 备案掉了网站会怎样信息流优化师简历怎么写
  • 市场调研方案最好用的系统优化软件
  • 商务网站大全网站推广途径和要点
  • 广州番禺网站公司哪家好新品推广计划与方案
  • phpcms 调用网站名称网站搜索引擎优化报告
  • 做网站一天能赚多少钱国际新闻头条最新消息
  • 长治市人民政府门户网站网络营销课程个人感悟
  • 沈阳做网站建设理发美发培训学校
  • 源代码网站培训水果营销软文
  • 北京 外贸网站建设友情链接交换系统
  • 网站如何做品牌营销app推广拉新渠道
  • 企业网站建设cms谷歌seo排名公司
  • 做优秀企业网站seo第三方点击软件
  • 网页 网 址网站区别营销网站
  • css怎么引入html长春seo外包
  • 深圳 电子商务网站开发新开传奇网站发布站
  • 书生网站班级优化大师官方免费下载
  • 做flash网站的软件职业培训网络平台
  • 珠海企业建站模板长沙官网网站推广优化