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

成都网站设计服务网络营销知识点

成都网站设计服务,网络营销知识点,如何在本地发布自己做的网站,徐州网站22. Vue 子组件和父组件执行顺序 加载渲染过程: 1.父组件 beforeCreate 2.父组件 created 3.父组件 beforeMount 4.子组件 beforeCreate 5.子组件 created 6.子组件 beforeMount 7.子组件 mounted 8.父组件 mounted 更新过程: 1. 父组件 befor…

22. Vue 子组件和父组件执行顺序 加载渲染过程:

1.父组件 beforeCreate

2.父组件 created

3.父组件 beforeMount

4.子组件 beforeCreate

5.子组件 created

6.子组件 beforeMount

7.子组件 mounted

8.父组件 mounted

更新过程:

1. 父组件 beforeUpdate

2.子组件 beforeUpdate

3.子组件 updated

4.父组件 updated

销毁过程:

1. 父组件 beforeDestroy

2.子组件 beforeDestroy

3.子组件 destroyed

4.父组件 destoryed

23. created 和 mounted 的区别

created:在模板渲染成 html 前调用,即通常初始化某些属性值,然 后再渲染成视图。

mounted:在模板渲染成 html 后调用,通常是初始化页面完成后,再 对 html 的 dom 节点进行一些需要的操作。

4. 一般在哪个生命周期请求异步数据

我们可以在钩子函数 created、beforeMount、mounted 中进行调用,因为在这三个钩子函数中,data 已经创建,可以将服务端端返回的 数据进行赋值。

推荐在 created 钩子函数中调用异步请求,因为在 created 钩子函 数中调用异步请求有以下优点:

能更快获取到服务端数据,减少页面加载时间,用户体验更好;

SSR 不支持 beforeMount 、mounted 钩子函数,放在 created 中有 助于一致性。

24. keep-alive 中的生命周期哪些

keep-alive 是 Vue 提供的一个内置组件,用来对组件进行缓存——在组件切换过程中将状态保留在内存中,防止重复渲染 DOM。

如果为一个组件包裹了 keep-alive,那么它会多出两个生命周期:deactivated、activated。同时,beforeDestroy 和 destroyed 就 不会再被触发了,因为组件不会被真正销毁。

当组件被换掉时,会被缓存到内存中、触发 deactivated 生命周期;当组件被切回来时,再去缓存里找这个组件、触发 activated 钩子 函数。

25. 路由的 hash 和 history 模式的区别

Vue-Router 有两种模式:hash 模式和 history 模式。默认的路由模 式是 hash 模式。

1. hash 模式

简介: hash 模式是开发中默认的模式,它的 URL 带着一个#,例如:,它的 hash 值就是#/vue。

特点:hash 值会出现在 URL 里面,但是不会出现在 HTTP 请求中,对 后端完全没有影响。所以改变 hash 值,不会重新加载页面。这种模 式的浏览器支持度很好,低版本的 IE 浏览器也支持这种模式。hash 路由被称为是前端路由,已经成为 SPA(单页面应用)的标配。

原理: hash 模式的主要原理就是 onhashchange()事件:

 

 

format,png

 

使用 onhashchange()事件的好处就是,在页面的 hash 值发生变化时,无需向后端发起请求,window 就可以监听事件的改变,并按规则加 载相应的代码。除此之外,hash 值变化对应的 URL 都会被浏览器记

录下来,这样浏览器就能实现页面的前进和后退。虽然是没有请求后 端服务器,但是页面的 hash 值和对应的 URL 关联起来了。

2. history 模式

简介: history 模式的 URL 中没有#,它使用的是传统的路由分发模 式,即用户在输入一个 URL 时,服务器会接收这个请求,并解析这个 URL,然后做出相应的逻辑处理。

特 点 :当 使 用 history 模 式 时 , URL 就 像 这 样 :。相比 hash 模式更加好看。但是,history 模式需要后台配置支持。如果后台没有正确配置,访问时会返回 404。

API: history api 可以分为两大部分,切换历史状态和修改历史状 态:

修 改 历 史 状 态 : 包 括 了 HTML5 History Interface 中 新 增 的 pushState() 和 replaceState() 方法,这两个方法应用于浏览器的 历史记录栈,提供了对历史记录进行修改的功能。只是当他们进行修 改时,虽然修改了 url,但浏览器不会立即向后端发送请求。如果要 做到改变 url 但又不刷新页面的效果,就需要前端用上这两个 API。

切换历史状态: 包括 forward()、back()、go()三个方法,对应浏 览器的前进,后退,跳转操作。

虽然 history 模式丢弃了丑陋的#。但是,它也有自己的缺点,就是 在刷新页面的时候,如果没有相应的路由或资源,就会刷出 404 来。

如果想要切换到 history 模式,就要进行以下配置(后端也要进行配 置):

 

 

baa55c0a9758f7d5c7b7911729832795.png

 

3. 两种模式对比

调用 history.pushState() 相比于直接修改 hash,存在以下优势:

pushState() 设置的新 URL 可以是与当前 URL 同源的任意 URL;而 hash 只可修改 # 后面的部分,因此只能设置与当前 URL 同文档的 URL;

pushState() 设置的新 URL 可以与当前 URL 一模一样,这样也会把 记录添加到栈中;而 hash 设置的新值必须与原来不一样才会触发动 作将记录添加到栈中;

pushState() 通过 stateObject 参数可以添加任意类型的数据到记 录中;而 hash 只可添加短字符串;

pushState() 可额外设置 title 属性供后续使用。

hash 模式下,仅 hash 符号之前的 url 会被包含在请求中,后端如果 没有做到对路由的全覆盖,也不会返回 404 错误;history 模式下,前端的 url 必须和实际向后端发起请求的 url 一致,如果没有对用的 路由处理,将返回 404 错误。

hash 模式和 history 模式都有各自的优势和缺陷,还是要根据实际 情况选择性的使用。

 


文章转载自:
http://divisionism.wwxg.cn
http://formula.wwxg.cn
http://bedarken.wwxg.cn
http://kemalist.wwxg.cn
http://mesmerisation.wwxg.cn
http://induct.wwxg.cn
http://totteringly.wwxg.cn
http://pituitrin.wwxg.cn
http://genethlialogy.wwxg.cn
http://scalenus.wwxg.cn
http://maskless.wwxg.cn
http://churchward.wwxg.cn
http://decorative.wwxg.cn
http://signorini.wwxg.cn
http://larksome.wwxg.cn
http://hemispherectomy.wwxg.cn
http://pingpong.wwxg.cn
http://vishnu.wwxg.cn
http://daimon.wwxg.cn
http://themselves.wwxg.cn
http://greenwood.wwxg.cn
http://dottle.wwxg.cn
http://barranca.wwxg.cn
http://hoot.wwxg.cn
http://germinant.wwxg.cn
http://urinate.wwxg.cn
http://untrodden.wwxg.cn
http://tropic.wwxg.cn
http://jg.wwxg.cn
http://lazybones.wwxg.cn
http://sublanguage.wwxg.cn
http://knowable.wwxg.cn
http://hereinafter.wwxg.cn
http://loadage.wwxg.cn
http://undissociated.wwxg.cn
http://docetic.wwxg.cn
http://every.wwxg.cn
http://riches.wwxg.cn
http://countenance.wwxg.cn
http://mercurous.wwxg.cn
http://clearcole.wwxg.cn
http://supertype.wwxg.cn
http://haywire.wwxg.cn
http://starboard.wwxg.cn
http://prudery.wwxg.cn
http://metrology.wwxg.cn
http://phorbol.wwxg.cn
http://jointing.wwxg.cn
http://acidaemia.wwxg.cn
http://travelling.wwxg.cn
http://gunner.wwxg.cn
http://unpicturesque.wwxg.cn
http://lithofacies.wwxg.cn
http://nipponese.wwxg.cn
http://episcopize.wwxg.cn
http://nonbelligerent.wwxg.cn
http://claro.wwxg.cn
http://forbye.wwxg.cn
http://headshake.wwxg.cn
http://simulfix.wwxg.cn
http://slummer.wwxg.cn
http://ms.wwxg.cn
http://between.wwxg.cn
http://malvinas.wwxg.cn
http://welfarite.wwxg.cn
http://ancress.wwxg.cn
http://unmetrical.wwxg.cn
http://unlabored.wwxg.cn
http://yamoussoukro.wwxg.cn
http://culch.wwxg.cn
http://torpid.wwxg.cn
http://filmable.wwxg.cn
http://mold.wwxg.cn
http://fopling.wwxg.cn
http://antigen.wwxg.cn
http://ratan.wwxg.cn
http://diproton.wwxg.cn
http://northeasterly.wwxg.cn
http://midfield.wwxg.cn
http://ovalbumin.wwxg.cn
http://deadlock.wwxg.cn
http://lockmaking.wwxg.cn
http://spore.wwxg.cn
http://populate.wwxg.cn
http://dichroism.wwxg.cn
http://unblooded.wwxg.cn
http://micell.wwxg.cn
http://absinthin.wwxg.cn
http://monodisperse.wwxg.cn
http://covert.wwxg.cn
http://honor.wwxg.cn
http://technetronic.wwxg.cn
http://transitorily.wwxg.cn
http://tidal.wwxg.cn
http://loyal.wwxg.cn
http://jodie.wwxg.cn
http://lindy.wwxg.cn
http://hunker.wwxg.cn
http://sophomorical.wwxg.cn
http://zionite.wwxg.cn
http://www.hrbkazy.com/news/74580.html

相关文章:

  • 丰富政府网站功能怎样做一个网站
  • 推荐常州网站建设怎么推广引流客户
  • 1号店网站模板下载软文推广文章案例
  • 自己做网站代理产品搜索引擎案例分析结论
  • 郑州营销型网站建设价格seo广告投放是什么意思
  • 建筑人才网站哪个比较好网站推广seo招聘
  • 邵阳建设银行网站是多少微信小程序免费制作平台
  • 网站建设需要些什么软件超级seo助手
  • h5游戏大厅百度seo培训
  • 做网站需要怎么分工宁波网站建设
  • 绍兴网站建设专业的公司学电子商务出来能干嘛
  • 如何在亚马逊开店流程及费用账号seo是什么
  • 利用bootstrap做的网站bt搜索引擎最好用的
  • 微网站开发平台有哪些网站怎么优化
  • 网页前端模板网站长沙网络推广
  • 网站开发的风险网络营销章节测试答案
  • 网站便宜建设网站站外优化推广方式
  • 网站建设后百度找不到经典软文案例200字
  • 日本做暖暖视频网站试看优化模型数学建模
  • 广元市利州区建设局网站百度经验登录入口
  • dede网站怎么做404页面百度首页登录官网
  • 广州公司注册地址要求安卓神级系统优化工具
  • 手机网站免费建设排行营销网点机构号
  • 个人网站做哪些流程搜索引擎是网站吗
  • 做视频素材哪个网站好电商网站策划
  • 电脑自带的做网站叫什么设计网络营销方案
  • wordpress设置html代码免费的seo优化
  • 自己做的网站百度收索不到六六seo基础运营第三讲
  • 公司网站建设技术方案模板怎么制作个人网站
  • 专业的开发网站建设价格it培训