avatar
fireworks99
keep hungry keep foolish
JS async/await

基于Promise的API,例如axios等,在使用时可以简化语法,方法是使用async/await组合。

await关键字只在 async 函数内有效。如果你在 async 函数体之外使用它,就会抛出语法错误 SyntaxError。

await 表达式会阻塞后续脚本的执行,直到其等待的基于 promise 的异步操作被兑现或被拒绝之后才会恢复进程。

Read more -->
JS this

1:this永远指向一个对象;

2:this的指向完全取决于函数调用的位置;

Read more -->
Vue :childProps.sync='parentData'

Description

Vue中,父组件通过props向子组件传递数据,如果子组件想要修改这一数据,只能通过$emit触发父组件的一个事件,在这个事件的处理方法中修改这个值。

现在有一种方法可以省略父组件中的这个method:

<cpn :childProps.sync='parentData'></cpn>

Read more -->
Vue i18n

Vue 国际化

  1. $t
  2. vue-i18n
Read more -->
Vue 表单验证

表单验证+响应性

实时验证表单填写是否正确

Read more -->
arr.some

Description

场景:现在有个数组,数组中必定有0或1个元素是我要找的,除了用for循环还可以用some方法。

Read more -->
Vue Router

路由的两种方式

  1. Hash:location.hash = 'about',形如file:///Users/.../202303311041.html#foo
  2. HTML5 History API:
    • history.pushState({}, '', "about") (可返回)
    • history.replaceState({}, '', about);不可返回
    • history.go(num)
Read more -->
Vue Vuex

需求:一个计数器组件,要渲染三次,这个计数器组件展示count变量,添加一个按钮,点击这个按钮一次,三个计数器都++。

Read more -->
Vue High order component

高阶组件

你原本有一个组件,你可以通过另外一个组件进行包裹,这个新的组件既具有原来组件的功能,又可以添加自己的功能,这种方式成为高阶组件。

Read more -->
Vue Render Function

1.渲染过程

Template => Render Function => Virtual DOM => Actual DOM

Read more -->
Site by Baole Zhao | Powered by Hexo | theme PreciousJoy