We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template-explorer SFC Playground
increaseingNewIndexSequence = moved ?getSequence(newIndexToOldIndexMap) : []
.value
并不是,模板编译之后,render 函数访问时,加上了 _ctx,_ctx 表示组件实例对象。组件通过 setup 函数返回的结果是 setupResult,在这里会对 setupResult 进行一层响应式处理,并返回给组件实例的 setupState 属性,所以访问 render 函数中的 _ctx.xxx 其实就是访问 instance.setupState.xxx。而响应式处理时,判断到是 ref 时,会进行解包操作,返回 .value 的值,即
_ctx
setupResult
setupState
_ctx.xxx
instance.setupState.xxx
ref
<template> <div>{{ msg }}</div> </template> /** * msg -> _ctx.msg -> instance.setupState.msg.value */
The text was updated successfully, but these errors were encountered:
No branches or pull requests
template-explorer
SFC Playground
1. diff 算法
increaseingNewIndexSequence = moved ?getSequence(newIndexToOldIndexMap) : []
2. 倒序遍历,方便我们把最后更新的子节点左右锚点;
3. 将 newIndexToOldIndexMap 中值为0的节点进行挂载;
4. 判断是否存在需要移动的情况,如果存在则看节点的索引是不是在最长递增子序列中,如果在,则倒序最长递增子序列(跳过移动,执行 j --,j 是最长递增子序列的长度),否则把它移动到锚点前面
2. 是不是模板编译的时候自动加上了
.value
?并不是,模板编译之后,render 函数访问时,加上了
_ctx
,_ctx
表示组件实例对象。组件通过 setup 函数返回的结果是setupResult
,在这里会对setupResult
进行一层响应式处理,并返回给组件实例的setupState
属性,所以访问 render 函数中的_ctx.xxx
其实就是访问instance.setupState.xxx
。而响应式处理时,判断到是ref
时,会进行解包操作,返回.value
的值,即The text was updated successfully, but these errors were encountered: