惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 司徒正美
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
博客园_首页
博客园 - 【当耐特】
Cisco Talos Blog
Cisco Talos Blog
J
Java Code Geeks
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
AWS News Blog
AWS News Blog
S
Schneier on Security
NISL@THU
NISL@THU
F
Fortinet All Blogs
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
量子位
IT之家
IT之家
T
The Exploit Database - CXSecurity.com
爱范儿
爱范儿
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
T
Tor Project blog
V
Vulnerabilities – Threatpost
V
Visual Studio Blog
宝玉的分享
宝玉的分享
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Privacy International News Feed
S
Securelist
P
Palo Alto Networks Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
T
Tenable Blog
B
Blog
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Threat Research - Cisco Blogs
T
Threatpost

Anthony Fu

Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony's Roads to Open Source - The Set Theory (React ver.) Mental Health in Open Source The Evolution of Shiki v1.0 The Magic in Shiki Magic Move Anthony's Roads to Open Source - The Progressive Path Anthony Fu Anthony Fu Anthony Fu Anthony's Roads to Open Source - The Set Theory Now, and the Future of Nuxt Devtools Anthony's Roads to Open Source - The Set Theory Anthony Fu Anthony Fu Stable Diffusion QR Code 101 Refining AI Generated QR Code Stylistic QR Code with Stable Diffusion Anthony Fu How I Manage GitHub Notifications Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Dev SSR on Nuxt with Vite Why I don't use Prettier Anthony Fu Anthony Fu Ship ESM & CJS in one Package Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Reflection of Speaking in Public Anthony Fu Windi CSS and Tailwind JIT Typed Provide and Inject in Vue Color Scheme for VS Code Anthony Fu Anthony Fu Anthony Fu Anthony Fu Anthony Fu Destructuring... with object or array? Anthony Fu Anthony Fu Make Libraries Working with Vue 2 and 3 Anthony Fu Anthony Fu Anthony Fu
Anthony Fu
Anthony Fu · 2020-07-01 · via Anthony Fu

Note: This is my personal notes/tips for migrating to Vue 3 and will be updated overtime. Please refer to the official docs for the complete changelog.

Sorted by the importance of my personal sense.

💫 use markRaw for vendor objects

The new reactivity system proxied the object passed to the Vue context. For vendor objects or class instances, you need to wrap it with markRaw in order to disable the reactivity injection.

// works in Vue 2
this.codemirror = CodeMirror.fromTextArea(el)

// in Vue 3 you need to use markRaw()
// otherwise the CodeMirror won't work as expected
this.codemirror = markRaw(CodeMirror.fromTextArea(el))

I think this is a pretty tricky one. You won’t see any warn or error on initialization, but the internal state of the vendor object might be messed up. You might face errors that comes from the libraries while couldn’t find out why (the example above took me one hour of debugging to find out).

💫 .syncv-model:

.sync modifier is unified by v-model:

<!-- Vue 2 -->
<Component name.sync="name" />

<!-- Vue 3 -->
<Component v-model:name="name" />

v-model on native element would be value/input while on custom components, it changed to modelValue and update:modelValue

💫 shims-vue.d.ts

Update: now you can use @vuedx/typescript-plugin-vue for better type inference with SFC (no need for shims-vue.d.ts then)

Changed to this:

declare module '*.vue' {
  import { defineComponent } from 'vue'

  const Component: ReturnType<typeof defineComponent>
  export default Component
}