---
# System prepended metadata

title: Vue3.0 vs Vue2.X Directive 寫法差異
tags: [Vue相關內容]

---

###### tags: `Vue相關內容`
# Vue3.0 vs Vue2.X Directive 寫法差異

## el與binding
1. el : 指定所綁定的元素，可用來操作dom
2. binding `v-text="value"`，binding.value可取道v-text賦予的值。


---

#### 全局註冊(Vue2.X)
![](https://i.imgur.com/BwB7BCc.png)
#### 全局註冊(Vue3.0)
![](https://i.imgur.com/nuYHago.png)


---

#### 插件寫法(Vue2.X)
![](https://i.imgur.com/ZBj26Zt.png)
#### 插件寫法(Vue3.0)
![](https://i.imgur.com/YrtRrV3.png)
![](https://i.imgur.com/u4G6eON.png)

---

#### 組件中註冊(Vue2.x)
![](https://i.imgur.com/NynX965.png)
#### 組件中註冊(Vue3.0)
![](https://i.imgur.com/2PIQdDL.png)


> 參考網站: https://blog.csdn.net/m0_46846526/article/details/118911913?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link