摘要: 1. 守护函数,也为守护钩子,是管理路由的生命周期中各个阶段注入的自定义函数。 全局前置和后置守护分别是:beforeEach和 afterEach、常用: router.beforeEach((to, from, next)=>{ loading.show() // 用户体验 next() // 阅读全文
posted @ 2021-06-09 09:33 anthonyliu 阅读(52) 评论(0) 推荐(0) 编辑
摘要: const vm = require('vm'); const user = { name: '<script>xss</script>' } // 中控 const templateMap = { templateA: '`<p>${include("templateB")}</p>`', tem 阅读全文
posted @ 2021-02-09 15:35 anthonyliu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 客户端,client.js const net = require('net') const socket = new net.Socket({}) const TestArr = [1,2, 3, 4] socket.connect({ host: '127.0.0.1', port: 4000 阅读全文
posted @ 2021-02-08 15:05 anthonyliu 阅读(405) 评论(0) 推荐(0) 编辑
摘要: // JS 道德经 混沌是什么? 混沌是null, 混沌中产生道。 // 道是什么? 道是Object.prototype 。它是最原始的对象。 console.log('Object.prototype.__proto__ is:', Object.prototype.__proto__) // 阅读全文
posted @ 2021-02-04 17:10 anthonyliu 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 1.除以2并取整 var x = 21 let right = x >> 1; // 除以2并取整,缩小一下遍历的范围 console.log('right=', right) //10 2.~操作 按位取反 var ifRange = "123456"; var x = ~ifRange.inde 阅读全文
posted @ 2021-01-08 09:53 anthonyliu 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 入口函数打包最终生成的bundle.js为一个即时函数。 (function(Array)) ([{},{}]) 参数为依赖Js模块组成的数组。每个数组是具有一定结构的对象: 阅读全文
posted @ 2020-09-09 14:43 anthonyliu 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1.babel是JS编译器 babel的作用是高版本语法转换成低版本语法。需要配合browserslistrc,如果说browserslistrc列举的浏览器支持高版本的语法,则不用转换。 2.babel有不少插件,每个插件的作用不一样 2.1 核心库 @babel/core 是必不可少的,它是其他 阅读全文
posted @ 2020-07-22 19:43 anthonyliu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 执行完Vue实例的beforeCreate钩子函数之后,接下解析<router-Link>和<router-view>这两个组件,并渲染到页面中。执行组件的render方法, // 可以忽略,只需要知道是把to(目标组件)路径格式化, // route 为location匹配到在Router中的路由 阅读全文
posted @ 2020-06-14 18:21 anthonyliu 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 插件执行入口: if (inBrowser && window.Vue) { window.Vue.use(VueRouter) // 传递给use的一个对象,这个对象必须实现install方法。 VueRouter.install = install} 在Vue.use中代码:plugin.ins 阅读全文
posted @ 2020-06-03 11:06 anthonyliu 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 声明:1.解决异步调用的写法和同步保持一致。 2.async是声明获取异步调用结果的函数,而await是声明在async函数中获取异步调用的结果的语句。 3.异步调用一般返回为promise,async执行完也会返回promise。 例1: function A(guess){ return new 阅读全文
posted @ 2020-03-04 13:18 anthonyliu 阅读(641) 评论(0) 推荐(0) 编辑