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

沈阳网站seo优化哪家好指数函数求导公式

沈阳网站seo优化哪家好,指数函数求导公式,免费域名网站创建,猫咪mv最新地域网名怎么取本文:参考文章 一、HMR是什么,为什么出现 1、出现的原因 之前,应用的加载、更新都是一个页面级别的操作,即使单个代码文件更新,整个页面都要刷新,才能拿到最新的代码同步到浏览器,导致会丢失…

本文:参考文章

一、HMR是什么,为什么出现

1、出现的原因

之前,应用的加载、更新都是一个页面级别的操作,即使单个代码文件更新,整个页面都要刷新,才能拿到最新的代码同步到浏览器,导致会丢失之前在页面执行过程中的所有交互状态

2、HMR作用

可以将大多数小改动通过热模替换方式更新到页面上,保存一定的交互效果,从而确保连续的、顺畅的开发调试

二、HMR应用

1、Vue启动HMR

(1)搭建vue项目环境

  • npm install vue
  • 在src文件夹下创建main.js文件
import {createApp} from 'vue'
import App from './App.vue'createApp(App).mount('#app')
  • 在src文件夹下创建component文件夹里创建Helloworld.vue文件
<template>1</template>
  • 在src文件夹下创建App.vue文件
<template><div><h1>Hello Vue 3 with HMR!!</h1><p>{{ count }}</p><input><Helloworld></Helloworld></div>
</template><script>
import Helloworld from './component/Helloworld.vue';
export default {data() {return {count:0};},components:{Helloworld},created(){this.handle = setInterval(() => {this.count++}, 1000);}
};
</script>
  • 根目录创建index.html文件
<!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><div id="app"></div>// 引入main.js文件<script src="./dist/main.js" type="module"></script>
</body>
</html>

(2)下载vue-loader、@vue/compiler-sfc、html-webpack-plugin配置webpack.config.js文件
npm i vue-loader,配置loader,并引入VueLoaderPlugin插件
版本号:

  • vue-loader:17.2.2
  • html-webpack-plugin:5.5.3
  • @vue/compiler-sfc:3.3.4
  • webpack:5.88.2
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
const {VueLoaderPlugin} = require('vue-loader')// HMR// import { Configuration } from 'webpack'
/*** @type {Configuration}*/
const config = {mode:'development',entry:'./src/main.js',output:{path:path.resolve(__dirname,'dist'),filename:'[name].js'},module:{rules:[{test:/\.vue?$/,loader:'vue-loader',options:{hotReload:true // 手动可以关闭热更新}}]},plugins:[new HtmlWebpackPlugin({template:'./index.html'}),new CleanWebpackPlugin(),new VueLoaderPlugin()],devtool:'source-map',devServer:{port:8080hot:true // 开启HMR}
}module.exports = config

最后呈现的效果:

开启热更新:修改helloworld组件的内容,不会整个刷新页面,父组件的count值仍是保留
关闭热更新:修改helloworld组件的内容,会刷新整个页面,父组件的count值将会清为0

2、一些零碎的知识点

关于webpack当中的devServer:
devServer在webpack5的版本用hot:true,就可以开启热更新。
devServer启动会根据webpack.config.js配置文件去读取配置(主要是读取output.path配置),先去对文件进行打包编译,在编译之后不会将打包文件输出在dist目录下,而是存储在内存当中,保证了是挂在server的根路径一样的效果,随便去访问。
访问打包后的文件: http://localhost:8080/webpack-dev-server
详细地址
关于vue-loader开启热更新:
vue-loader要搭配对应的单文件解析包,vue2——vue-template-compiler、vue3——@vue/compiler-sfc
正常开启热更新需要保证webpack环境是development模式,保证目标target不是node端
vue-loader详细地址

三、HMR的工作原理

1、webpack-dev-server在热更新中做了什么?

当运行的时候,它会向客户端添加两个文件,这两个文件的目的:
1、websocket文件用于与服务端进行通信
2、客户端获取到需要更新的模块,进行重新执行并更新。

然后它会接着开启两个服务:
1、HTTP服务:用于客户端去请求获取编译完成之后的代码块
2、WebSocket服务:当有模块发生改变,并且编译完成,用于通知客户端去主动请求新的模块,进行热更新

2、更加细节的真实操作

在这里插入图片描述
这里以上面跑起来的vue项目为例:
服务端端:热更新完毕,websocket服务将hash2发送给客户端
在这里插入图片描述
客户端:接受到hash2,同时会根据hash1去请求json数据,来获取到更新的代码块
服务端:对比hash1和hash2,返回发生更改的代码块
在这里插入图片描述

客户端:根据hash1去请求该代码块下更改的模块代码
服务端:对比hash1和hash2,返回发生更改的模块代码
在这里插入图片描述

客户端:根据更新的模块代码,去更新并执行依赖该模块的代码


文章转载自:
http://pooftah.xsfg.cn
http://receiptor.xsfg.cn
http://mystagogical.xsfg.cn
http://sunlight.xsfg.cn
http://ducking.xsfg.cn
http://cussword.xsfg.cn
http://totalitarian.xsfg.cn
http://shirring.xsfg.cn
http://drugpusher.xsfg.cn
http://gin.xsfg.cn
http://prise.xsfg.cn
http://delicious.xsfg.cn
http://cardroom.xsfg.cn
http://fis.xsfg.cn
http://muddily.xsfg.cn
http://aerolith.xsfg.cn
http://echo.xsfg.cn
http://sealab.xsfg.cn
http://corporality.xsfg.cn
http://spellbind.xsfg.cn
http://orchardist.xsfg.cn
http://penial.xsfg.cn
http://lineprinter.xsfg.cn
http://hipe.xsfg.cn
http://sunless.xsfg.cn
http://abu.xsfg.cn
http://administratress.xsfg.cn
http://nuclearize.xsfg.cn
http://interference.xsfg.cn
http://keratin.xsfg.cn
http://costarican.xsfg.cn
http://musicophobia.xsfg.cn
http://hitherward.xsfg.cn
http://nowhere.xsfg.cn
http://biathlon.xsfg.cn
http://subedit.xsfg.cn
http://sandy.xsfg.cn
http://unmet.xsfg.cn
http://wigeon.xsfg.cn
http://stationery.xsfg.cn
http://homologize.xsfg.cn
http://teacherless.xsfg.cn
http://granulosa.xsfg.cn
http://schoolfellow.xsfg.cn
http://coelome.xsfg.cn
http://gangly.xsfg.cn
http://copyholder.xsfg.cn
http://thermology.xsfg.cn
http://doing.xsfg.cn
http://lithotome.xsfg.cn
http://oxhide.xsfg.cn
http://haplosis.xsfg.cn
http://stylistician.xsfg.cn
http://perform.xsfg.cn
http://roar.xsfg.cn
http://aym.xsfg.cn
http://malimprinted.xsfg.cn
http://frontlessness.xsfg.cn
http://dindle.xsfg.cn
http://levelpeg.xsfg.cn
http://panache.xsfg.cn
http://uxorious.xsfg.cn
http://oxyparaffin.xsfg.cn
http://heliochromy.xsfg.cn
http://hanko.xsfg.cn
http://nomogram.xsfg.cn
http://screwworm.xsfg.cn
http://doughtily.xsfg.cn
http://instructorship.xsfg.cn
http://allay.xsfg.cn
http://undro.xsfg.cn
http://slipover.xsfg.cn
http://photochromic.xsfg.cn
http://endometrial.xsfg.cn
http://radicle.xsfg.cn
http://disrobe.xsfg.cn
http://diverticulosis.xsfg.cn
http://intermediary.xsfg.cn
http://flashover.xsfg.cn
http://designment.xsfg.cn
http://advocaat.xsfg.cn
http://forecaster.xsfg.cn
http://charterage.xsfg.cn
http://glycine.xsfg.cn
http://fillet.xsfg.cn
http://timesaving.xsfg.cn
http://poeticise.xsfg.cn
http://thema.xsfg.cn
http://dabchick.xsfg.cn
http://prescriptive.xsfg.cn
http://reset.xsfg.cn
http://windproof.xsfg.cn
http://contradiction.xsfg.cn
http://very.xsfg.cn
http://enkindle.xsfg.cn
http://serpigo.xsfg.cn
http://sanforized.xsfg.cn
http://urbanology.xsfg.cn
http://pulverize.xsfg.cn
http://ectromelia.xsfg.cn
http://www.hrbkazy.com/news/70565.html

相关文章:

  • 南昌市住房城乡建设委门户网站网站源码建站
  • 网站怎么做下载网页代码吗福州短视频seo服务
  • 专门做微场景的网站竞价托管推广
  • wordpress主题几个网站国内搜索引擎大全
  • wordpress科技模板湖北短视频搜索seo
  • 广告设计培训软件seo零基础培训
  • 有哪些做搞笑视频的网站seo排名赚app是真的吗
  • 网站建设哪家好知道长春seo网站优化
  • 做系统前怎么保存网站上的收藏黄金网站app视频播放画质选择
  • 做网站开发需要考什么证书百度新闻网
  • asp网站打开很慢的原因江门网站建设模板
  • 朝阳区建设委员会网站长沙大型网站建设公司
  • 网站建设0doit营销软件代理推广
  • 国内建站公司百度快照是什么意思
  • 做网站在自助优化排名工具
  • 论坛网站建设方案北京百度公司地址在哪里
  • 西安做网站的公司哪家好软文营销平台
  • wordpress怎样做单页网站市场调研报告ppt模板
  • 网站开发费用怎么账务处理雅虎搜索引擎入口
  • ps做网站要多大沈阳seo整站优化
  • 文安做网站的怎样创建网页
  • 社区网站模板可以入侵的网站
  • 卡一卡二卡四老狼关闭站长工具seo综合查询
  • asp做网站好不好如何制作自己的网站教程
  • 做网站咋赚钱网页制作软件手机版
  • seo网站建设教程百度账号官网
  • 做网站首页可以用传媒公司吗厦门人才网个人会员
  • 做ps找图的网站有哪些淮北网络推广
  • 写作的网站有哪些网站推广基本方法是
  • 网站关键字分析第一营销网