diff --git a/README.md b/README.md
index 5443cc56a2..86dc20a48e 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ See the [Vue Docs Writing Guide](https://v3.vuejs.org/guide/writing-guide.html)
1. Clone repository
```bash
-git clone git@github.com:vuejs/docs.git
+git clone https://github.com/vuejs/docs.git
```
2. Install dependencies
diff --git a/src/.vuepress/components/community/team/emeriti.js b/src/.vuepress/components/community/team/emeriti.js
index fe7e1fb9f2..d1c343bf56 100644
--- a/src/.vuepress/components/community/team/emeriti.js
+++ b/src/.vuepress/components/community/team/emeriti.js
@@ -1,6 +1,27 @@
import { shuffle } from 'lodash'
export default shuffle([
+ {
+ name: 'Sarah Drasner',
+ city: 'Denver, CO, USA',
+ languages: ['en'],
+ work: {
+ role: 'Director of Engineering, Core Developer Web',
+ org: 'Google',
+ orgUrl: 'https://google.com/',
+ },
+ github: 'sdras',
+ twitter: 'sarah_edo',
+ codepen: 'sdras',
+ reposOfficial: ['vuejs.org'],
+ reposPersonal: [
+ 'vue-vscode-snippets',
+ 'intro-to-vue',
+ 'vue-vscode-extensionpack',
+ 'ecommerce-netlify',
+ ],
+ links: ['https://sarah.dev/'],
+ },
{
name: 'Chris Fritz',
title: 'Good Word Putter-Togetherer',
@@ -9,11 +30,9 @@ export default shuffle([
github: 'chrisvfritz',
twitter: 'chrisvfritz',
work: {
- role: 'Educator & Consultant'
+ role: 'Educator & Consultant',
},
- reposPersonal: [
- 'vue-enterprise-boilerplate'
- ]
+ reposPersonal: ['vue-enterprise-boilerplate'],
},
{
name: 'Blake Newman',
@@ -23,10 +42,10 @@ export default shuffle([
work: {
role: 'Software Engineer',
org: 'Attest',
- orgUrl: 'https://www.askattest.com/'
+ orgUrl: 'https://www.askattest.com/',
},
github: 'blake-newman',
- twitter: 'blakenewman'
+ twitter: 'blakenewman',
},
{
name: 'kingwl',
@@ -36,12 +55,10 @@ export default shuffle([
work: {
role: 'Software Development Engineer',
org: 'Chaitin',
- orgUrl: 'https://chaitin.cn/'
+ orgUrl: 'https://chaitin.cn/',
},
github: 'kingwl',
- reposOfficial: [
- 'vue'
- ]
+ reposOfficial: ['vue'],
},
{
name: 'Alan Song',
@@ -51,12 +68,10 @@ export default shuffle([
work: {
role: 'Cofounder',
org: 'Futurenda',
- orgUrl: 'https://www.futurenda.com/'
+ orgUrl: 'https://www.futurenda.com/',
},
github: 'fnlctrl',
- reposOfficial: [
- 'vue-router'
- ]
+ reposOfficial: ['vue-router'],
},
{
name: 'defcc',
@@ -66,8 +81,8 @@ export default shuffle([
github: 'defcc',
work: {
org: 'zbj.com',
- orgUrl: 'http://www.zbj.com/'
- }
+ orgUrl: 'http://www.zbj.com/',
+ },
},
{
name: 'gebilaoxiong',
@@ -77,8 +92,8 @@ export default shuffle([
github: 'gebilaoxiong',
work: {
org: 'zbj.com',
- orgUrl: 'http://www.zbj.com/'
- }
+ orgUrl: 'http://www.zbj.com/',
+ },
},
{
name: 'Denis Karabaza',
@@ -90,8 +105,8 @@ export default shuffle([
work: {
role: 'Software Engineer',
org: 'Neolant',
- orgUrl: 'http://neolant.ru/'
- }
+ orgUrl: 'http://neolant.ru/',
+ },
},
{
name: 'Edd Yerburgh',
@@ -101,16 +116,10 @@ export default shuffle([
github: 'eddyerburgh',
twitter: 'EddYerburgh',
work: {
- role: 'Full Stack Developer'
+ role: 'Full Stack Developer',
},
- reposOfficial: [
- 'vue-test-utils'
- ],
- reposPersonal: [
- 'avoriaz'
- ],
- links: [
- 'https://www.eddyerburgh.me/'
- ]
- }
+ reposOfficial: ['vue-test-utils'],
+ reposPersonal: ['avoriaz'],
+ links: ['https://www.eddyerburgh.me/'],
+ },
])
diff --git a/src/.vuepress/components/community/team/members.js b/src/.vuepress/components/community/team/members.js
index 509c2779fd..d374aa1541 100644
--- a/src/.vuepress/components/community/team/members.js
+++ b/src/.vuepress/components/community/team/members.js
@@ -10,11 +10,11 @@ const members = [
twitter: 'youyuxi',
work: {
role: 'Creator',
- org: 'Vue.js'
+ org: 'Vue.js',
},
reposOfficial: ['vuejs/*', 'vuejs-templates/*'],
- links: ['https://www.patreon.com/evanyou']
- }
+ links: ['https://www.patreon.com/evanyou'],
+ },
].concat(
shuffle([
{
@@ -25,11 +25,11 @@ const members = [
github: 'posva',
twitter: 'posva',
work: {
- role: 'Freelance Developer & Consultant'
+ role: 'Freelance Developer & Consultant',
},
reposOfficial: ['vuefire', 'vue-router'],
reposPersonal: ['vuex-mock-store', 'vue-promised', 'vue-motion'],
- links: ['https://www.patreon.com/posva']
+ links: ['https://www.patreon.com/posva'],
},
{
name: 'Sodatea',
@@ -37,7 +37,7 @@ const members = [
languages: ['zh', 'en'],
github: 'sodatea',
twitter: 'haoqunjiang',
- reposOfficial: ['vue-cli', 'vue-loader']
+ reposOfficial: ['vue-cli', 'vue-loader'],
},
{
name: 'Pine Wu',
@@ -46,9 +46,9 @@ const members = [
github: 'octref',
twitter: 'octref',
work: {
- role: 'Nomad'
+ role: 'Nomad',
},
- reposOfficial: ['vetur']
+ reposOfficial: ['vetur'],
},
{
name: 'Jinjiang',
@@ -61,8 +61,8 @@ const members = [
'vue-a11y-utils',
'vue-mark-display',
'mark2slides',
- 'vue-keyboard-over'
- ]
+ 'vue-keyboard-over',
+ ],
},
{
name: 'Katashin',
@@ -72,12 +72,12 @@ const members = [
work: {
role: 'Software Engineer',
org: 'ClassDo',
- orgUrl: 'https://classdo.com/'
+ orgUrl: 'https://classdo.com/',
},
github: 'ktsn',
twitter: 'ktsn',
reposOfficial: ['vuex', 'vue-class-component'],
- reposPersonal: ['vue-designer']
+ reposPersonal: ['vue-designer'],
},
{
name: 'Kazupon',
@@ -89,7 +89,7 @@ const members = [
work: {
role: 'Engineer',
org: 'PLAID, Inc.',
- orgUrl: 'https://plaid.co.jp/'
+ orgUrl: 'https://plaid.co.jp/',
},
reposOfficial: ['vuejs.org', 'jp.vuejs.org'],
reposPersonal: [
@@ -98,9 +98,9 @@ const members = [
'vue-i18n-loader',
'eslint-plugin-vue-i18n',
'vue-i18n-extensions',
- 'vue-cli-plugin-p11n'
+ 'vue-cli-plugin-p11n',
],
- links: ['https://www.patreon.com/kazupon']
+ links: ['https://www.patreon.com/kazupon'],
},
{
name: 'Rahul Kadyan',
@@ -110,13 +110,13 @@ const members = [
work: {
role: 'Software Engineer',
org: 'Grammarly',
- orgUrl: 'https://grammarly.com/'
+ orgUrl: 'https://grammarly.com/',
},
github: 'znck',
twitter: 'znck0',
reposOfficial: ['rollup-plugin-vue', 'vue-next'],
reposPersonal: ['vue-developer-experience', 'prop-types', 'grammarly'],
- links: ['https://znck.me/']
+ links: ['https://znck.me/'],
},
{
name: 'Linusborg',
@@ -127,7 +127,7 @@ const members = [
twitter: 'Linus_Borg',
reposOfficial: ['vuejs/*'],
reposPersonal: ['portal-vue'],
- links: ['https://forum.vuejs.org/']
+ links: ['https://forum.vuejs.org/'],
},
{
name: 'Guillaume Chau',
@@ -139,37 +139,16 @@ const members = [
work: {
role: 'Frontend Developer',
org: 'Livestorm',
- orgUrl: 'https://livestorm.co/'
+ orgUrl: 'https://livestorm.co/',
},
reposOfficial: ['vue-devtools', 'vue-cli', 'vue-curated'],
reposPersonal: [
'vue-apollo',
'vue-meteor',
'vue-virtual-scroller',
- 'v-tooltip'
- ],
- links: ['http://patreon.com/akryum']
- },
- {
- name: 'Sarah Drasner',
- city: 'Denver, CO, USA',
- languages: ['en'],
- work: {
- role: 'VP of Developer Experience',
- org: 'Netlify',
- orgUrl: 'https://url.netlify.com/HJ8X2mxP8'
- },
- github: 'sdras',
- twitter: 'sarah_edo',
- codepen: 'sdras',
- reposOfficial: ['vuejs.org'],
- reposPersonal: [
- 'vue-vscode-snippets',
- 'intro-to-vue',
- 'vue-vscode-extensionpack',
- 'ecommerce-netlify'
+ 'v-tooltip',
],
- links: ['https://sarah.dev/']
+ links: ['http://patreon.com/akryum'],
},
{
name: 'Damian Dulisz',
@@ -179,10 +158,10 @@ const members = [
github: 'shentao',
twitter: 'DamianDulisz',
work: {
- role: 'Consultant'
+ role: 'Consultant',
},
reposOfficial: ['news.vuejs.org'],
- reposPersonal: ['shentao/vue-multiselect', 'shentao/vue-global-events']
+ reposPersonal: ['shentao/vue-multiselect', 'shentao/vue-global-events'],
},
{
name: 'Michał Sajnóg',
@@ -193,10 +172,10 @@ const members = [
work: {
role: 'Senior Frontend Developer / Team Leader',
org: 'Netguru',
- orgUrl: 'https://netguru.co/'
+ orgUrl: 'https://netguru.co/',
},
reposOfficial: ['eslint-plugin-vue', 'vue-devtools'],
- reposPersonal: ['vue-computed-helpers', 'vue-content-placeholders']
+ reposPersonal: ['vue-computed-helpers', 'vue-content-placeholders'],
},
{
name: 'GU Yiling',
@@ -205,7 +184,7 @@ const members = [
work: {
role: 'Senior web developer',
org: 'Baidu, inc.',
- orgUrl: 'https://www.baidu.com/'
+ orgUrl: 'https://www.baidu.com/',
},
github: 'Justineo',
twitter: '_justineo',
@@ -213,8 +192,8 @@ const members = [
reposPersonal: [
'Justineo/vue-awesome',
'ecomfe/vue-echarts',
- 'ecomfe/veui'
- ]
+ 'ecomfe/veui',
+ ],
},
{
name: 'ULIVZ',
@@ -223,11 +202,11 @@ const members = [
work: {
role: 'Senior Frontend Developer',
org: 'AntFinancial',
- orgUrl: 'https://www.antfin.com/'
+ orgUrl: 'https://www.antfin.com/',
},
github: 'ulivz',
twitter: '_ulivz',
- reposOfficial: ['vuepress']
+ reposOfficial: ['vuepress'],
},
{
name: 'Phan An',
@@ -239,11 +218,11 @@ const members = [
work: {
role: 'Engineering Team Lead',
org: 'InterNations',
- orgUrl: 'https://www.internations.org/'
+ orgUrl: 'https://www.internations.org/',
},
reposOfficial: ['vuejs.org'],
reposPersonal: ['vuequery', 'vue-google-signin-button'],
- links: ['https://vi.vuejs.org/', 'https://phanan.net/']
+ links: ['https://vi.vuejs.org/', 'https://phanan.net/'],
},
{
name: 'Natalia Tepluhina',
@@ -254,10 +233,10 @@ const members = [
work: {
role: 'Staff Frontend Engineer',
org: 'GitLab',
- orgUrl: 'https://gitlab.com/'
+ orgUrl: 'https://gitlab.com/',
},
github: 'NataliaTepluhina',
- twitter: 'N_Tepluhina'
+ twitter: 'N_Tepluhina',
},
{
name: 'Yosuke Ota',
@@ -268,9 +247,9 @@ const members = [
work: {
role: 'Lead Web Engineer',
org: 'Future Corporation',
- orgUrl: 'https://www.future.co.jp/'
+ orgUrl: 'https://www.future.co.jp/',
},
- reposOfficial: ['eslint-plugin-vue']
+ reposOfficial: ['eslint-plugin-vue'],
},
{
name: 'Ben Hong',
@@ -278,12 +257,12 @@ const members = [
languages: ['en', 'zh'],
work: {
role: 'Developer Experience (DX) Engineer',
- org: 'Cypress.io'
+ org: 'Cypress.io',
},
reposOfficial: ['vuejs.org', 'vuepress', 'vuejs/events'],
github: 'bencodezen',
twitter: 'bencodezen',
- links: ['https://bencodezen.io/']
+ links: ['https://bencodezen.io/'],
},
{
name: 'Kia King Ishii',
@@ -293,12 +272,12 @@ const members = [
work: {
role: 'Tech Talent',
org: 'Global Brain',
- orgUrl: 'https://globalbrains.com/'
+ orgUrl: 'https://globalbrains.com/',
},
github: 'kiaking',
twitter: 'KiaKing85',
reposOfficial: ['vuex'],
- reposPersonal: ['vuex-orm/*']
+ reposPersonal: ['vuex-orm/*'],
},
{
name: 'Anthony Fu',
@@ -308,8 +287,8 @@ const members = [
twitter: 'antfu7',
reposOfficial: ['composition-api'],
reposPersonal: ['vueuse', 'vue-demi', 'vue-reactivity/*'],
- links: ['https://antfu.me/']
- }
+ links: ['https://antfu.me/'],
+ },
])
)
diff --git a/src/.vuepress/components/community/team/partners.js b/src/.vuepress/components/community/team/partners.js
index 5e1dd97968..2caeb13211 100644
--- a/src/.vuepress/components/community/team/partners.js
+++ b/src/.vuepress/components/community/team/partners.js
@@ -211,15 +211,14 @@ export default shuffle([
github: 'rstoenescu',
twitter: 'quasarframework',
work: {
- role: 'Developer',
+ role: 'Author',
org: 'Quasar Framework',
- orgUrl: 'http://quasar-framework.org/'
+ orgUrl: 'http://quasar.dev/'
},
reposPersonal: [
- 'quasarframework/quasar',
- 'quasarframework/quasar-cli',
- 'quasarframework/quasar-play'
- ]
+ 'quasarframework/quasar'
+ ],
+ links: ['https://quasar.dev/']
},
{
name: 'Jilson Thomas',
diff --git a/src/.vuepress/components/community/themes/theme-data.js b/src/.vuepress/components/community/themes/theme-data.js
index 24732e3b0c..7e0d9ffc1b 100644
--- a/src/.vuepress/components/community/themes/theme-data.js
+++ b/src/.vuepress/components/community/themes/theme-data.js
@@ -127,22 +127,29 @@ export default [
},
{
name: 'PrimeVue',
- description: `The open-source UI component library [PrimeVue](https://www.primefaces.org/primevue/#/?af_id=4218) offers over 80 flexible components to build your apps with! They have a ton of different component themes and Vue-CLI application templates available to get the look&feel that suits you best.`,
+ description: `The open-source UI component library [PrimeVue](https://www.primefaces.org/primevue/#/?af_id=4218) offers over 80 flexible components to build your apps with! They have a ton of different component themes and Vue-CLI application templates available to get the look & feel that suits you best.`,
seeMoreUrl: 'https://www.primefaces.org/primevue/#/?af_id=4218',
products: [
{
- name: 'Freya',
+ name: 'Sakai',
+ price: 0,
+ description: 'Free Admin Template',
+ url: 'https://www.primefaces.org/sakai-vue/#/?af_id=4218',
+ image: 'https://www.primefaces.org/vue-templates/sakai.jpg'
+ },
+ {
+ name: 'Atlantis',
price: 59,
description: 'Premium Admin Template',
- url: 'https://www.primefaces.org/layouts/freya-vue?af_id=4218',
- image: 'https://www.primefaces.org/vue-templates/freya.jpg'
+ url: 'https://www.primefaces.org/layouts/atlantis-vue?af_id=4218',
+ image: 'https://www.primefaces.org/vue-templates/atlantis.jpg'
},
{
- name: 'Diamond',
+ name: 'Freya',
price: 59,
- description: 'PrimeOne Design Admin Template',
- url: 'https://www.primefaces.org/layouts/diamond-vue?af_id=4218',
- image: 'https://www.primefaces.org/vue-templates/diamond.jpg'
+ description: 'Premium Admin Template',
+ url: 'https://www.primefaces.org/layouts/freya-vue?af_id=4218',
+ image: 'https://www.primefaces.org/vue-templates/freya.jpg'
},
{
name: 'Ultima',
@@ -151,6 +158,13 @@ export default [
url: 'https://www.primefaces.org/layouts/ultima-vue?af_id=4218',
image: 'https://www.primefaces.org/vue-templates/ultima.jpg'
},
+ {
+ name: 'Diamond',
+ price: 59,
+ description: 'PrimeOne Design Admin Template',
+ url: 'https://www.primefaces.org/layouts/diamond-vue?af_id=4218',
+ image: 'https://www.primefaces.org/vue-templates/diamond.jpg'
+ },
{
name: 'Sapphire',
price: 49,
@@ -199,19 +213,12 @@ export default [
description: 'Highly Customizable Admin Template',
url: 'https://www.primefaces.org/layouts/prestige-vue?af_id=4218',
image: 'https://www.primefaces.org/vue-templates/prestige.jpg'
- },
- {
- name: 'Sigma',
- price: 0,
- description: 'Free Admin Template',
- url: 'https://www.primefaces.org/sigma-vue/#/?af_id=4218',
- image: 'https://www.primefaces.org/vue-templates/sigma.jpg'
}
]
},
{
name: 'Flatlogic',
- description: `Check the admin dashboards templates built by our partners from [Flatlogic](https://flatlogic.com/templates?ref=x-fdkuTAVW). With these themes you can see how real applications is built. Additionally these templates will help you to start a new application and save you time and money.`,
+ description: `Check out the admin dashboard templates built by our partners from [Flatlogic](https://flatlogic.com/templates?ref=x-fdkuTAVW). With these themes you can see how real applications are built. Additionally, these templates will help you to start a new application and save you time and money.`,
seeMoreUrl: 'https://flatlogic.com/templates?ref=x-fdkuTAVW',
products: [
{
diff --git a/src/.vuepress/components/guide/contributing/translations-data.js b/src/.vuepress/components/guide/contributing/translations-data.js
index 82b5ba206b..aef5d0ef29 100644
--- a/src/.vuepress/components/guide/contributing/translations-data.js
+++ b/src/.vuepress/components/guide/contributing/translations-data.js
@@ -13,7 +13,7 @@ export const labels = {
export const repos = [
{ lang: 'en-us', owner: 'vuejs', repo: 'docs', branch: 'master', url: 'https://v3.vuejs.org/' },
{ lang: 'fr', owner: 'demahom18', repo: 'docs-next', branch: 'master', url: 'https://vue3-fr.netlify.app/' },
- { lang: 'id', owner: 'vuejs-id', repo: 'docs-next', branch: 'indonesian' },
+ { lang: 'id', owner: 'vuejs-id', repo: 'docs-next', branch: 'indonesian', url: 'https://v3-vuejsid-docs.netlify.app/' },
{ lang: 'ja', owner: 'vuejs-jp', repo: 'ja.vuejs.org', branch: 'lang-ja', url: 'https://v3.ja.vuejs.org/' },
{ lang: 'ko', owner: 'vuejs-kr', repo: 'docs-next', branch: 'rootKoKr', url: 'https://v3.ko.vuejs.org/' },
{ lang: 'pt-br', owner: 'vuejs-br', repo: 'docs-next', branch: 'master', url: 'https://vuejsbr-docs-next.netlify.app/' },
diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js
index dc24ac170e..3370925c2c 100644
--- a/src/.vuepress/config.js
+++ b/src/.vuepress/config.js
@@ -274,7 +274,7 @@ module.exports = {
'link',
{
href:
- 'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
+ 'https://fonts.googleapis.com/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap',
rel: 'stylesheet'
}
],
@@ -296,6 +296,7 @@ module.exports = {
['link', { rel: 'manifest', href: '/manifest.json' }],
['meta', { name: 'theme-color', content: '#3eaf7c' }],
['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
+ ['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }],
[
'meta',
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black' }
@@ -509,7 +510,7 @@ module.exports = {
custom: 'CKYD62QM',
placement: 'vuejsorg'
},
- topBanner: false
+ topBanner: true
},
plugins: [
[
diff --git a/src/.vuepress/public/images/sponsors/autocode.svg b/src/.vuepress/public/images/sponsors/autocode.svg
deleted file mode 100644
index 25c3bde4f1..0000000000
--- a/src/.vuepress/public/images/sponsors/autocode.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/.vuepress/public/images/sponsors/hbuilder.png b/src/.vuepress/public/images/sponsors/hbuilder.png
new file mode 100644
index 0000000000..a2615f8e44
Binary files /dev/null and b/src/.vuepress/public/images/sponsors/hbuilder.png differ
diff --git a/src/.vuepress/theme/components/BannerTop.vue b/src/.vuepress/theme/components/BannerTop.vue
deleted file mode 100644
index 6e18821d4a..0000000000
--- a/src/.vuepress/theme/components/BannerTop.vue
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Extended! Last few hours for the Vue School offer
-
-
- GET ACCESS
-
-
-
-
-
-
-
-
-
diff --git a/src/.vuepress/theme/data/patreon-sponsors.js b/src/.vuepress/theme/data/patreon-sponsors.js
index 324fbc7b40..608cb5541c 100644
--- a/src/.vuepress/theme/data/patreon-sponsors.js
+++ b/src/.vuepress/theme/data/patreon-sponsors.js
@@ -7,10 +7,9 @@ export default {
],
"special_sponsors": [
{
- "url": "https://autocode.com/",
- "img": "autocode.svg",
- "name": "Autocode",
- "description": "Build app-to-app workflows and connect APIs"
+ "url": "https://www.dcloud.io/hbuilderx.html?hmsr=vue-en&hmpl=&hmcu=&hmkw=&hmci=",
+ "img": "hbuilder.png",
+ "name": "HBuilder"
}
],
"platinum_sponsors": [
diff --git a/src/.vuepress/theme/layouts/Layout.vue b/src/.vuepress/theme/layouts/Layout.vue
index dd8984d652..10e09d60bd 100644
--- a/src/.vuepress/theme/layouts/Layout.vue
+++ b/src/.vuepress/theme/layouts/Layout.vue
@@ -5,8 +5,6 @@
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>
-
-
@@ -52,7 +50,6 @@ import Page from '@theme/components/Page.vue'
import Sidebar from '@theme/components/Sidebar.vue'
import BuySellAds from '@theme/components/BuySellAds.vue'
import CarbonAds from '@theme/components/CarbonAds.vue'
-import BannerTop from '@theme/components/BannerTop.vue'
import { resolveSidebarItems } from '../util'
export default {
@@ -63,15 +60,15 @@ export default {
Page,
Sidebar,
Navbar,
- BannerTop,
BuySellAds,
CarbonAds
},
data() {
return {
- showTopBanner: false,
- isSidebarOpen: false
+ isSidebarOpen: false,
+ isMenuFixed: false,
+ menuPosition: 0
}
},
@@ -115,8 +112,7 @@ export default {
{
'no-navbar': !this.shouldShowNavbar,
'sidebar-open': this.isSidebarOpen,
- 'no-sidebar': !this.shouldShowSidebar,
- 'has-top-banner': this.showTopBanner
+ 'no-sidebar': !this.shouldShowSidebar
},
userPageClass
]
@@ -131,8 +127,6 @@ export default {
this.$router.afterEach(() => {
this.isSidebarOpen = false
})
-
- this.showTopBanner = false
},
methods: {
diff --git a/src/.vuepress/theme/styles/code.styl b/src/.vuepress/theme/styles/code.styl
index fe065d88f4..a27e3b0f20 100644
--- a/src/.vuepress/theme/styles/code.styl
+++ b/src/.vuepress/theme/styles/code.styl
@@ -31,6 +31,7 @@ div[class*="language-"]
background-color #f6f6f6
border-radius 6px
.highlight-lines
+ border-radius 6px
background-color #f6f6f6
color #3a385d
user-select none
@@ -142,7 +143,7 @@ div.reactivecontent
// @import 'http://github.com/~prismjs/themes/prism-tomorrow.css'
-.token.punctuation
+.token.punctuation
color #a8a9cc
.token.tag, .token.attr-name, .token.namespace, .token.deleted
@@ -169,4 +170,6 @@ div.reactivecontent
div[class*=language-].line-numbers-mode .line-numbers-wrapper, div[class*=language-].line-numbers-mode:after
background-color #f6f6f6
color #c4c4c6
- border-right 1px solid #e7e6e6
\ No newline at end of file
+ border-right 1px solid #e7e6e6
+ border-top-left-radius 6px
+ border-bottom-left-radius 6px
diff --git a/src/api/application-api.md b/src/api/application-api.md
index 2dd0d7b498..b6a1470cc8 100644
--- a/src/api/application-api.md
+++ b/src/api/application-api.md
@@ -96,7 +96,8 @@ app.directive('my-directive', {
mounted() {},
// called before the containing component's VNode is updated
beforeUpdate() {},
- // called after the containing component's VNode and the VNodes of its children // have updated
+ // called after the containing component's VNode and the VNodes of its
+ // children have updated
updated() {},
// called before the bound element's parent component is unmounted
beforeUnmount() {},
@@ -234,7 +235,7 @@ app.mount('#my-app')
Providing values via the application is especially useful when writing plugins, as plugins typically wouldn't be able to provide values using components. It is an alternative to using [globalProperties](application-config.html#globalproperties).
:::tip Note
- The `provide` and `inject` bindings are NOT reactive. This is intentional. However, if you pass down an observed object, properties on that object do remain reactive.
+ The `provide` and `inject` bindings are NOT reactive. This is intentional. However, if you pass down a reactive object, properties on that object do remain reactive.
:::
- **Example:**
@@ -297,9 +298,9 @@ setTimeout(() => app.unmount(), 5000)
- **Usage:**
- Install a Vue.js plugin. If the plugin is an Object, it must expose an `install` method. If it is a function itself, it will be treated as the install method.
+ Install a Vue.js plugin. If the plugin is an Object, it must expose an `install` method. If it is a function itself, it will be treated as the `install` method.
- The install method will be called with the application as its first argument. Any `options` passed to `use` will be passed on in subsequent arguments.
+ The `install` method will be called with the application as its first argument. Any `options` passed to `use` will be passed on in subsequent arguments.
When this method is called on the same plugin multiple times, the plugin will be installed only once.
diff --git a/src/api/application-config.md b/src/api/application-config.md
index 0bd8bdc2b1..b53487fe81 100644
--- a/src/api/application-config.md
+++ b/src/api/application-config.md
@@ -26,7 +26,7 @@ app.config.errorHandler = (err, vm, info) => {
}
```
-Assign a handler for uncaught errors during component render function and watchers. The handler gets called with the error and the application instance.
+Assign a handler for uncaught errors during component render function and watchers. The handler gets called with the error and the corresponding application instance.
> Error tracking services [Sentry](https://sentry.io/for/vue/) and [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) provide official integrations using this option.
@@ -146,7 +146,7 @@ This config option is only respected when using the full build (i.e. the standal
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('ion-')
```
-Specifies a method to recognize custom elements defined outside of Vue (e.g., using the Web Components APIs). If component matches this condition, it won't need local or global registration and Vue won't throw a warning about an `Unknown custom element`.
+Specifies a method to recognize custom elements defined outside of Vue (e.g., using the Web Components APIs). If a component matches this condition, it won't need local or global registration and Vue won't throw a warning about an `Unknown custom element`.
> Note that all native HTML and SVG tags don't need to be matched in this function - Vue parser performs this check automatically.
diff --git a/src/api/built-in-components.md b/src/api/built-in-components.md
index 1e5b1dd454..0f1e4bb398 100644
--- a/src/api/built-in-components.md
+++ b/src/api/built-in-components.md
@@ -20,7 +20,7 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
- **Props:**
- - `is` - `string | Component`
+ - `is` - `string | Component | VNode`
- **Usage:**
@@ -41,6 +41,8 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
```
+- **Usage with built-in components:**
+
The built-in components `KeepAlive`, `Transition`, `TransitionGroup`, and `Teleport` can all be passed to `is`, but you must register them if you want to pass them by name. For example:
```js
@@ -62,6 +64,16 @@ import { KeepAlive, Teleport, Transition, TransitionGroup } from 'vue'
Registration is not required if you pass the component itself to `is` rather than its name.
+- **Usage with VNodes:**
+
+ In advanced use cases, it can sometimes be useful to render an existing VNode via a template. Using a `` makes this possible, but it should be seen as an escape hatch, used to avoid rewriting the entire template as a `render` function.
+
+ ```html
+
+ ```
+
+ A caveat of mixing VNodes and templates in this way is that you need to provide a suitable `key` attribute. The VNode will be considered static, so any updates will be ignored unless the `key` changes. The `key` can be on the VNode or the `` tag, but either way it must change every time you want the VNode to re-render. This caveat doesn't apply if the nodes have different types, e.g. changing a `span` to a `div`.
+
- **See also:** [Dynamic Components](../guide/component-dynamic-async.html)
## transition
diff --git a/src/api/composition-api.md b/src/api/composition-api.md
index 14405575f7..7101d40b74 100644
--- a/src/api/composition-api.md
+++ b/src/api/composition-api.md
@@ -41,6 +41,7 @@ A component option that is executed **before** the component is created, once th
attrs: Data
slots: Slots
emit: (event: string, ...args: unknown[]) => void
+ expose: (exposed?: Record) => void
}
function setup(props: Data, context: SetupContext): Data
@@ -89,12 +90,37 @@ A component option that is executed **before** the component is created, once th
setup() {
const readersNumber = ref(0)
const book = reactive({ title: 'Vue 3 Guide' })
- // Please note that we need to explicitly expose ref value here
+ // Please note that we need to explicitly use ref value here
return () => h('div', [readersNumber.value, book.title])
}
}
```
+ If you return a render function then you can't return any other properties. If you need to expose properties so that they can be accessed externally, e.g. via a `ref` in the parent, you can use `expose`:
+
+ ```js
+ // MyBook.vue
+
+ import { h } from 'vue'
+
+ export default {
+ setup(props, { expose }) {
+ const reset = () => {
+ // Some reset logic
+ }
+
+ // Expose can only be called once.
+ // If you need to expose multiple properties, they must all
+ // be included in the object passed to expose.
+ expose({
+ reset
+ })
+
+ return () => h('div')
+ }
+ }
+ ```
+
- **See also**: [Composition API `setup`](../guide/composition-api-setup.html)
## Lifecycle Hooks
diff --git a/src/api/directives.md b/src/api/directives.md
index b58ee877d0..02cc8a0a85 100644
--- a/src/api/directives.md
+++ b/src/api/directives.md
@@ -35,7 +35,7 @@
- **Example:**
```html
-
+
```
- **See also:** [Data Binding Syntax - Interpolations](../guide/template-syntax.html#raw-html)
diff --git a/src/api/global-api.md b/src/api/global-api.md
index 6527cb5a50..eec4d7c9e8 100644
--- a/src/api/global-api.md
+++ b/src/api/global-api.md
@@ -193,9 +193,7 @@ createApp({
})
```
-For advanced usage, `defineAsyncComponent` can accept an object:
-
-The `defineAsyncComponent` method can also return an object of the following format:
+For advanced usage, `defineAsyncComponent` can accept an object of the following format:
```js
import { defineAsyncComponent } from 'vue'
diff --git a/src/api/options-composition.md b/src/api/options-composition.md
index 602534013f..03c2f3f00f 100644
--- a/src/api/options-composition.md
+++ b/src/api/options-composition.md
@@ -294,7 +294,7 @@ The `setup` function is a new component option. It serves as the entry point for
The `props` object is immutable for userland code during development (will emit warning if user code attempts to mutate it).
- The second argument provides a context object which exposes a selective list of properties that were previously exposed on `this`:
+ The second argument provides a context object which exposes various objects and functions that might be useful in `setup`:
```js
const MyComponent = {
@@ -302,10 +302,13 @@ The `setup` function is a new component option. It serves as the entry point for
context.attrs
context.slots
context.emit
+ context.expose
}
}
```
+ `attrs`, `slots`, and `emit` are equivalent to the instance properties [`$attrs`](/api/instance-properties.html#attrs), [`$slots`](/api/instance-properties.html#slots), and [`$emit`](/api/instance-methods.html#emit) respectively.
+
`attrs` and `slots` are proxies to the corresponding values on the internal component instance. This ensures they always expose the latest values even after updates so that we can destructure them without worrying about accessing a stale reference:
```js
@@ -319,6 +322,26 @@ The `setup` function is a new component option. It serves as the entry point for
}
```
+ `expose`, added in Vue 3.2, is a function that allows specific properties to be exposed via the public component instance. By default, the public instance retrieved using refs, `$parent`, or `$root` is equivalent to the internal instance used by the template. Calling `expose` will create a separate public instance with the properties specified:
+
+ ```js
+ const MyComponent = {
+ setup(props, { expose }) {
+ const count = ref(0)
+ const reset = () => count.value = 0
+ const increment = () => count.value++
+
+ // Only reset will be available externally, e.g. via $refs
+ expose({
+ reset
+ })
+
+ // Internally, the template has access to count and increment
+ return { count, increment }
+ }
+ }
+ ```
+
There are a number of reasons for placing `props` as a separate first argument instead of including it in the context:
- It's much more common for a component to use `props` than the other properties, and very often a component uses only `props`.
diff --git a/src/api/options-data.md b/src/api/options-data.md
index 7c5425563f..502516b075 100644
--- a/src/api/options-data.md
+++ b/src/api/options-data.md
@@ -301,3 +301,39 @@
:::
* **See also:** [Attribute Inheritance](../guide/component-attrs.html#attribute-inheritance)
+
+## expose
+
+- **Type:** `Array`
+
+- **Details:**
+
+ A list of properties to expose on the public component instance.
+
+ By default, the public instance accessed via [`$refs`](/api/instance-properties.html#refs), [`$parent`](/api/instance-properties.html#parent), or [`$root`](/api/instance-properties.html#root) is the same as the internal component instance that's used by the template. The `expose` option restricts the properties that can be accessed via the public instance.
+
+ Properties defined by Vue itself, such as `$el` and `$parent`, will always be available on the public instance and don't need to be listed.
+
+- **Usage:**
+
+ ```js
+ export default {
+ // increment will be exposed but count
+ // will only be accessible internally
+ expose: ['increment'],
+
+ data() {
+ return {
+ count: 0
+ }
+ },
+
+ methods: {
+ increment() {
+ this.count++
+ }
+ }
+ }
+ ```
+
+- **See also:** [defineExpose](/api/sfc-script-setup.html#defineexpose)
diff --git a/src/api/options-lifecycle-hooks.md b/src/api/options-lifecycle-hooks.md
index dab2e2e36f..18f3fa22a2 100644
--- a/src/api/options-lifecycle-hooks.md
+++ b/src/api/options-lifecycle-hooks.md
@@ -140,7 +140,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
- **Details:**
- Called after a component instance has been unmounted. When this hook is called, all directives of the component instance have been unbound, all event listeners have been removed, and all child component instance have also been unmounted.
+ Called after a component instance has been unmounted. When this hook is called, all directives of the component instance have been unbound, all event listeners have been removed, and all child component instances have also been unmounted.
**This hook is not called during server-side rendering.**
diff --git a/src/api/sfc-script-setup.md b/src/api/sfc-script-setup.md
index a775ebf4c9..fcf0462278 100644
--- a/src/api/sfc-script-setup.md
+++ b/src/api/sfc-script-setup.md
@@ -89,7 +89,7 @@ Think of `MyComponent` as being referenced as a variable. If you have used JSX,
### Dynamic Components
-Since components are referenced as variables instead of registered under string keys, we should use dynamic `:is` binding when using dynamic components inside `
+
+ This is a Heading
+
+```
+```html
+
+```
+
## `defineProps` and `defineEmits`
-To declare options like `props` and `emits` with full type inference support, we can use the `defineProps` and `defineEmits` APIs, which are automatically available inside `
```
+:::warning
+`render` function is not supported in this scenario. Please use one normal `
+
+
+```
+
### Type-only props/emit declarations
Props and emits can also be declared using pure-type syntax by passing a literal type argument to `defineProps` or `defineEmits`:
diff --git a/src/api/sfc-spec.md b/src/api/sfc-spec.md
index bf198be682..3e08d89203 100644
--- a/src/api/sfc-spec.md
+++ b/src/api/sfc-spec.md
@@ -34,7 +34,7 @@ export default {
### ``
-- Each `*.vue` file can contain at most one `` block at a time.
+- Each `*.vue` file can contain at most one top-level `` block at a time.
- Contents will be extracted and passed on to `@vue/compiler-dom`, pre-compiled into JavaScript render functions, and attached to the exported component as its `render` option.
diff --git a/src/api/sfc-tooling.md b/src/api/sfc-tooling.md
index f38bc59292..bd5bdf7c72 100644
--- a/src/api/sfc-tooling.md
+++ b/src/api/sfc-tooling.md
@@ -10,6 +10,8 @@ You don't need to install anything on your machine to try out Vue SFCs - there a
- [Vue on Repl.it](https://replit.com/@templates/VueJS-with-Vite)
- [Vue on Codepen](https://codepen.io/pen/editor/vue)
- [Vue on StackBlitz](https://stackblitz.com/fork/vue)
+- [Vue on Components.studio](https://components.studio/create/vue3)
+- [Vue on WebComponents.dev](https://webcomponents.dev/create/cevue)
It is also recommended to use these online playgrounds to provide reproductions when reporting bugs.
diff --git a/src/api/special-attributes.md b/src/api/special-attributes.md
index 5dc0ad7962..3206d29c4d 100644
--- a/src/api/special-attributes.md
+++ b/src/api/special-attributes.md
@@ -2,9 +2,9 @@
## key
-- **Expects:** `number | string`
+- **Expects:** `number | string | symbol`
- The `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify VNodes when diffing the new list of nodes against the old list. Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed/destroyed.
+ The `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify VNodes when comparing the new list of nodes against the old list. Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed/destroyed.
Children of the same common parent must have **unique keys**. Duplicate keys will cause render errors.
diff --git a/src/coc/index.md b/src/coc/index.md
index fd53230a08..29a950b967 100644
--- a/src/coc/index.md
+++ b/src/coc/index.md
@@ -2,7 +2,7 @@
## Our Pledge
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.
## Our Standards
diff --git a/src/community/join.md b/src/community/join.md
index b78cbf359c..bb4ef014b4 100644
--- a/src/community/join.md
+++ b/src/community/join.md
@@ -41,7 +41,7 @@ After that, you'll be ready to contribute to Vue's core repositories:
Apart from answering questions and sharing resources in the forum and chat, there are a few other less obvious ways to share and expand what you know:
- **Develop learning materials.** It's often said that the best way to learn is to teach. If there's something interesting you're doing with Vue, strengthen your expertise by writing a blog post, developing a workshop, or even publishing a gist that you share on social media.
-- **Watch a repo you care about.** This will send you notifications whenever there's activity in that repository, giving you insider knowledge about ongoing discussions and upcoming features. It's a fantastic way to build expertise so that you're eventually able to help address issues and pull requests.
+- **Watch a repo you care about.** This will send you notifications whenever there's an activity in that repository, giving you insider knowledge about ongoing discussions and upcoming features. It's a fantastic way to build expertise so that you're eventually able to help address issues and pull requests.
### Translate Docs
diff --git a/src/cookbook/debugging-in-vscode.md b/src/cookbook/debugging-in-vscode.md
index 274831d34c..f43f789a77 100644
--- a/src/cookbook/debugging-in-vscode.md
+++ b/src/cookbook/debugging-in-vscode.md
@@ -1,15 +1,12 @@
# Debugging in VS Code
-Every application reaches a point where it's necessary to understand failures, small to large. In this recipe, we explore a few workflows for VS Code users who would like to debug their application in the browser.
+Every application reaches a point where it's necessary to understand failures, small to large. In this recipe, we explore a few workflows for VS Code users who would like to debug their applications in the browser.
This recipe shows how to debug [Vue CLI](https://github.com/vuejs/vue-cli) applications in VS Code as they run in the browser.
## Prerequisites
-Make sure you have VS Code and the browser of your choice installed, and the latest version of the corresponding Debugger extension installed and enabled:
-
-- [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)
-- [Debugger for Firefox](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-firefox-debug)
+Make sure you have VS Code and the browser of your choice installed.
Install and create a project with the [vue-cli](https://github.com/vuejs/vue-cli), following the instructions in the [Vue CLI Guide](https://cli.vuejs.org/). Change into the newly created application directory and open VS Code.
diff --git a/src/cookbook/editable-svg-icons.md b/src/cookbook/editable-svg-icons.md
index 360a076777..c0f85ce5e7 100644
--- a/src/cookbook/editable-svg-icons.md
+++ b/src/cookbook/editable-svg-icons.md
@@ -2,7 +2,7 @@
## Base Example
-There are many ways to create an SVG Icon System, but one method that takes advantage of Vue's capabilities is to create editable inline icons as components. Some of the advantages of this way of working is:
+There are many ways to create an SVG Icon System, but one method that takes advantage of Vue's capabilities is to create editable inline icons as components. Some of the advantages of this way of working are:
- They are easy to edit on the fly
- They are animatable
@@ -141,7 +141,7 @@ export default {
}
```
-We're applying `refs` to the groups of paths we need to move, and as both sides of the scissors have to move in tandem, we'll create a function we can reuse where we'll pass in the `refs`. The use of GreenSock helps resolve animation support and `transform-origin` issues across browser.
+We're applying `refs` to the groups of paths we need to move, and as both sides of the scissors have to move in tandem, we'll create a function we can reuse where we'll pass in the `refs`. The use of GreenSock helps resolve animation support and `transform-origin` issues across browsers.
@@ -151,7 +151,7 @@ You can see more animated examples in the repo [here](https://github.com/sdras/v
## Additional Notes
-Designers may change their minds. Product requirements change. Keeping the logic for the entire icon system in one base component means you can quickly update all of your icons and have it propagate through the whole system. Even with the use of an icon loader, some situations require you to recreate or edit every SVG to make global changes. This method can save you that time and pain.
+Designers may change their minds. Product requirements change. Keeping the logic for the entire icon system in one base component means you can quickly update all of your icons and have them propagate through the whole system. Even with the use of an icon loader, some situations require you to recreate or edit every SVG to make global changes. This method can save you that time and pain.
## When To Avoid This Pattern
@@ -164,4 +164,4 @@ Other tooling to help manage SVG icons includes:
- [svg-sprite-loader](https://github.com/kisenka/svg-sprite-loader)
- [svgo-loader](https://github.com/rpominov/svgo-loader)
-These tools bundle SVGs at compile time, but make them a little harder to edit during runtime, because `` tags can have strange cross-browser issues when doing anything more complex. They also leave you with two nested `viewBox` properties and thus two coordinate systems. This makes the implementation a little more complex.
+These tools bundle SVGs at time of compilation, but make them a little harder to edit during runtime, because `` tags can have strange cross-browser issues when doing anything more complex. They also leave you with two nested `viewBox` properties and thus two coordinate systems. This makes the implementation a little more complex.
diff --git a/src/cookbook/index.md b/src/cookbook/index.md
index 13060edb85..d384e3118a 100644
--- a/src/cookbook/index.md
+++ b/src/cookbook/index.md
@@ -66,7 +66,7 @@ It's extremely helpful to write a bit about this pattern, where else it would ap
### When To Avoid This Pattern
-This section is not required, but heavily recommended. It won't make sense to write it for something very simple such as toggling classes based on state change, but for more advanced patterns like mixins it's vital. The answer to most questions about development is ["It depends!"](https://codepen.io/rachsmith/pen/YweZbG), this section embraces that. Here, we'll take an honest look at when the pattern is useful and when it should be avoided, or when something else makes more sense.
+This section is not required but heavily recommended. It won't make sense to write it for something very simple such as toggling classes based on state change, but for more advanced patterns like mixins, it's vital. The answer to most questions about development is ["It depends!"](https://codepen.io/rachsmith/pen/YweZbG), this section embraces that. Here, we'll take an honest look at when the pattern is useful and when it should be avoided, or when something else makes more sense.
### Alternative Patterns
diff --git a/src/guide/a11y-basics.md b/src/guide/a11y-basics.md
index e55d2648a8..5e5e30f3cb 100644
--- a/src/guide/a11y-basics.md
+++ b/src/guide/a11y-basics.md
@@ -1,6 +1,6 @@
# Basics
-Web accessibility (also known as a11y) refers to the practice of creating websites that can be used by anyone — be that a person with a disability, a slow connection, outdated or broken hardware or simply someone in an unfavorable environment. For example, adding subtitles to a video would help both your deaf and hard-of-hearing users and your users who are in a loud environment and can't hear their phone. Similarly, making sure your text isn't too low contrast will help both your low-vision users and your users who are trying to use their phone in bright sunlight.
+Web accessibility (also known as a11y) refers to the practice of creating websites that can be used by anyone — be that a person with a disability, a slow connection, outdated or broken hardware, or simply someone in an unfavorable environment. For example, adding subtitles to a video would help both your deaf and hard-of-hearing users and your users who are in a loud environment and can't hear their phones. Similarly, making sure your text isn't too low contrast will help both your low-vision users and your users who are trying to use their phones in bright sunlight.
Ready to start but aren’t sure where?
@@ -8,7 +8,7 @@ Checkout the [Planning and managing web accessibility guide](https://www.w3.org/
## Skip link
-You should add a link at the top of each page that goes directly to the main content area so users can skip content that is repeated on multiple Web pages.
+You should add a link at the top of each page that goes directly to the main content area so that users can skip content that was repeated on multiple Web pages.
Typically this is done on the top of `App.vue` as it will be the first focusable element on all your pages:
diff --git a/src/guide/component-attrs.md b/src/guide/component-attrs.md
index 0b6b9746c0..691a7fa6d3 100644
--- a/src/guide/component-attrs.md
+++ b/src/guide/component-attrs.md
@@ -2,7 +2,7 @@
> This page assumes you've already read the [Components Basics](component-basics.md). Read that first if you are new to components.
-A component non-prop attribute is an attribute or event listener that is passed to a component, but does not have a corresponding property defined in [props](component-props) or [emits](component-custom-events.html#defining-custom-events). Common examples of this include `class`, `style`, and `id` attributes. You can access those attributes via `$attrs` property.
+A component non-prop attribute is an attribute or event listener that is passed to a component, but does not have a corresponding property defined in [props](component-props.html) or [emits](component-custom-events.html#defining-custom-events). Common examples of this include `class`, `style`, and `id` attributes. You can access those attributes via `$attrs` property.
## Attribute Inheritance
@@ -82,7 +82,7 @@ If you do **not** want a component to automatically inherit attributes, you can
The common scenario for disabling an attribute inheritance is when attributes need to be applied to other elements besides the root node.
-By setting the `inheritAttrs` option to `false`, you can control to apply to other elements attributes to use the component's `$attrs` property, which includes all attributes not included to component `props` and `emits` properties (e.g., `class`, `style`, `v-on` listeners, etc.).
+By setting the `inheritAttrs` option to `false`, you can then apply attributes to the element of your choice by using the component's `$attrs` property, which includes all attributes not included to component `props` and `emits` properties (e.g., `class`, `style`, `v-on` listeners, etc.).
Using our date-picker component example from the [previous section](#attribute-inheritance), in the event we need to apply all non-prop attributes to the `input` element rather than the root `div` element, this can be accomplished by using the `v-bind` shortcut.
diff --git a/src/guide/component-basics.md b/src/guide/component-basics.md
index fa9f4312dc..9d647f4c71 100644
--- a/src/guide/component-basics.md
+++ b/src/guide/component-basics.md
@@ -1,5 +1,7 @@
# Components Basics
+Learn component basics with a free video course on Vue School
+
## Base Example
Here's an example of a Vue component:
diff --git a/src/guide/component-custom-events.md b/src/guide/component-custom-events.md
index f1b40e5b7b..4b91982257 100644
--- a/src/guide/component-custom-events.md
+++ b/src/guide/component-custom-events.md
@@ -4,7 +4,7 @@
## Event Names
-Like components and props, event names provide an automatic case transformation. If you emit an event from the child component in camel case, you will be able to add a kebab-cased listener in the parent:
+Like components and props, event names provide an automatic case transformation. If you emit an event from the child component in camelCase, you will be able to add a kebab-cased listener in the parent:
```js
this.$emit('myEvent')
@@ -89,9 +89,6 @@ app.component('my-component', {
})
```
-```html
-
-```
## Multiple `v-model` bindings
diff --git a/src/guide/component-props.md b/src/guide/component-props.md
index e8d2ee60dc..6a2a45f264 100644
--- a/src/guide/component-props.md
+++ b/src/guide/component-props.md
@@ -2,6 +2,8 @@
> This page assumes you've already read the [Components Basics](component-basics.md). Read that first if you are new to components.
+Learn how component props work with a free lesson on Vue School
+
## Prop Types
So far, we've only seen props listed as an array of strings:
@@ -61,6 +63,7 @@ In the two examples above, we happen to pass string values, but _any_ type of va
```html
+
@@ -151,8 +154,8 @@ computed: {
}
```
-::: tip Note
-Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect parent state.
+::: warning Warning
+Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect the parent state and Vue is unable to warn you against this. As a general rule, you should avoid mutating any prop, including objects and arrays as doing so ignores one-way data binding and may cause undesired results.
:::
## Prop Validation
diff --git a/src/guide/component-provide-inject.md b/src/guide/component-provide-inject.md
index dcf966dc95..54ef54fc4b 100644
--- a/src/guide/component-provide-inject.md
+++ b/src/guide/component-provide-inject.md
@@ -67,7 +67,7 @@ app.component('todo-list', {
})
```
-To access component instance properties, we need to convert `provide` to be a function returning an object
+To access component instance properties, we need to convert `provide` to be a function returning an object:
```js
app.component('todo-list', {
diff --git a/src/guide/component-registration.md b/src/guide/component-registration.md
index 0f561af5df..d7c17eb642 100644
--- a/src/guide/component-registration.md
+++ b/src/guide/component-registration.md
@@ -1,5 +1,7 @@
# Component Registration
+Learn how component registration works with a free lesson on Vue School
+
> This page assumes you've already read the [Components Basics](component-basics.md). Read that first if you are new to components.
## Component Names
diff --git a/src/guide/component-slots.md b/src/guide/component-slots.md
index 154d4f8a8d..9bbab509b7 100644
--- a/src/guide/component-slots.md
+++ b/src/guide/component-slots.md
@@ -2,6 +2,8 @@
> This page assumes you've already read the [Components Basics](component-basics.md). Read that first if you are new to components.
+Learn slot basics with a free lesson on Vue School
+
## Slot Content
Vue implements a content distribution API inspired by the [Web Components spec draft](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md), using the `` element to serve as distribution outlets for content.
@@ -23,7 +25,7 @@ Then in the template for ``, you might have:
```
-When the component renders, ` ` will be replaced by "Add Todo".
+When the component renders, ` ` will be replaced by "Add todo".
```html
@@ -90,7 +92,7 @@ The slot does **not** have access to ``'s scope. For example, tryin
Clicking here will {{ action }} an item
@@ -222,7 +224,7 @@ The rendered HTML will be:
```
-Note that **`v-slot` can only be added to a ``** (with [one exception](#abbreviated-syntax-for-lone-default-slots))
+Note that **`v-slot` can only be added to a ``** (with [one exception](#abbreviated-syntax-for-lone-default-slots)).
## Scoped Slots
diff --git a/src/guide/composition-api-introduction.md b/src/guide/composition-api-introduction.md
index ad771308b0..079c380bfe 100644
--- a/src/guide/composition-api-introduction.md
+++ b/src/guide/composition-api-introduction.md
@@ -67,7 +67,7 @@ It would be much nicer if we could collocate code related to the same logical co
## Basics of Composition API
-Now that we know the **why** we can get to the **how**. To start working with the Composition API we first need a place where we can actually use it. In a Vue component, we call this place the `setup`.
+Now that we know the **why**, we can get to the **how**. To start working with the Composition API we first need a place where we can actually use it. In a Vue component, we call this place the `setup`.
### `setup` Component Option
@@ -320,7 +320,7 @@ import { ref, onMounted, watch, toRefs } from 'vue'
// in our component
setup (props) {
- // using `toRefs` to create a Reactive Reference to the `user` property of props
+ // using `toRefs` to create a Reactive Reference to the `user` property of `props`
const { user } = toRefs(props)
const repositories = ref([])
diff --git a/src/guide/composition-api-lifecycle-hooks.md b/src/guide/composition-api-lifecycle-hooks.md
index 9745620b24..793a8825fa 100644
--- a/src/guide/composition-api-lifecycle-hooks.md
+++ b/src/guide/composition-api-lifecycle-hooks.md
@@ -1,5 +1,7 @@
# Lifecycle Hooks
+> This section uses [single-file component](single-file-component.html) syntax for code examples
+
> This guide assumes that you have already read the [Composition API Introduction](composition-api-introduction.html) and [Reactivity Fundamentals](reactivity-fundamentals.html). Read that first if you are new to Composition API.
Watch a free video about Lifecycle Hooks on Vue Mastery
diff --git a/src/guide/composition-api-provide-inject.md b/src/guide/composition-api-provide-inject.md
index 8be3d50b97..e5913234ae 100644
--- a/src/guide/composition-api-provide-inject.md
+++ b/src/guide/composition-api-provide-inject.md
@@ -1,5 +1,7 @@
# Provide / Inject
+> This section uses [single-file component](single-file-component.html) syntax for code examples
+
> This guide assumes that you have already read [Provide / Inject](component-provide-inject.html), [Composition API Introduction](composition-api-introduction.html), and [Reactivity Fundamentals](reactivity-fundamentals.html).
We can use [provide / inject](component-provide-inject.html) with the Composition API as well. Both can only be called during [`setup()`](composition-api-setup.html) with a current active instance.
diff --git a/src/guide/composition-api-setup.md b/src/guide/composition-api-setup.md
index e9312fae08..b9c828b48d 100644
--- a/src/guide/composition-api-setup.md
+++ b/src/guide/composition-api-setup.md
@@ -64,21 +64,24 @@ setup(props) {
### Context
-The second argument passed to the `setup` function is the `context`. The `context` is a normal JavaScript object that exposes three component properties:
+The second argument passed to the `setup` function is the `context`. The `context` is a normal JavaScript object that exposes other values that may be useful inside `setup`:
```js
// MyBook.vue
export default {
setup(props, context) {
- // Attributes (Non-reactive object)
+ // Attributes (Non-reactive object, equivalent to $attrs)
console.log(context.attrs)
- // Slots (Non-reactive object)
+ // Slots (Non-reactive object, equivalent to $slots)
console.log(context.slots)
- // Emit Events (Method)
+ // Emit events (Function, equivalent to $emit)
console.log(context.emit)
+
+ // Expose public properties (Function)
+ console.log(context.expose)
}
}
```
@@ -88,17 +91,19 @@ The `context` object is a normal JavaScript object, i.e., it is not reactive, th
```js
// MyBook.vue
export default {
- setup(props, { attrs, slots, emit }) {
+ setup(props, { attrs, slots, emit, expose }) {
...
}
}
```
-`attrs` and `slots` are stateful objects that are always updated when the component itself is updated. This means you should avoid destructuring them and always reference properties as `attrs.x` or `slots.x`. Also note that unlike `props`, `attrs` and `slots` are **not** reactive. If you intend to apply side effects based on `attrs` or `slots` changes, you should do so inside an `onUpdated` lifecycle hook.
+`attrs` and `slots` are stateful objects that are always updated when the component itself is updated. This means you should avoid destructuring them and always reference properties as `attrs.x` or `slots.x`. Also note that, unlike `props`, the properties of `attrs` and `slots` are **not** reactive. If you intend to apply side effects based on changes to `attrs` or `slots`, you should do so inside an `onBeforeUpdate` lifecycle hook.
+
+We'll explain the role of `expose` shortly.
## Accessing Component Properties
-When `setup` is executed, the component instance has not been created yet. As a result, you will only be able to access the following properties:
+When `setup` is executed, you will only be able to access the following properties:
- `props`
- `attrs`
@@ -110,6 +115,7 @@ In other words, you **will not have access** to the following component options:
- `data`
- `computed`
- `methods`
+- `refs` (template refs)
## Usage with Templates
@@ -157,12 +163,35 @@ export default {
setup() {
const readersNumber = ref(0)
const book = reactive({ title: 'Vue 3 Guide' })
- // Please note that we need to explicitly expose ref value here
+ // Please note that we need to explicitly use ref value here
return () => h('div', [readersNumber.value, book.title])
}
}
```
+Returning a render function prevents us from returning anything else. Internally that shouldn't be a problem, but it can be problematic if we want to expose methods of this component to the parent component via template refs.
+
+We can solve this problem by calling `expose`, passing it an object that defines the properties that should be available on the external component instance:
+
+```js
+import { h, ref } from 'vue'
+
+export default {
+ setup(props, { expose }) {
+ const count = ref(0)
+ const increment = () => ++count.value
+
+ expose({
+ increment
+ })
+
+ return () => h('div', count.value)
+ }
+}
+```
+
+The `increment` method would then be available in the parent component via a template ref.
+
## Usage of `this`
**Inside `setup()`, `this` won't be a reference to the current active instance** Since `setup()` is called before other component options are resolved, `this` inside `setup()` will behave quite differently from `this` in other options. This might cause confusions when using `setup()` along other Options API.
diff --git a/src/guide/custom-directive.md b/src/guide/custom-directive.md
index 47156b48dc..0f0d8b6db5 100644
--- a/src/guide/custom-directive.md
+++ b/src/guide/custom-directive.md
@@ -49,7 +49,7 @@ A directive definition object can provide several hook functions (all optional):
- `beforeMount`: called when the directive is first bound to the element and before parent component is mounted.
-- `mounted`: called when the bound element's parent component is mounted.
+- `mounted`: called before the bound element's parent component is mounted.
- `beforeUpdate`: called before the containing component's VNode is updated
@@ -214,4 +214,4 @@ app.component('my-component', {
Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`.
-With [fragments](/guide/migration/fragments.html#overview) support, components can potentially have more than one root nodes. When applied to a multi-root component, directive will be ignored and the warning will be thrown.
+With [fragments](/guide/migration/fragments.html#overview) support, components can potentially have more than one root node. When applied to a multi-root component, directive will be ignored and the warning will be thrown.
diff --git a/src/guide/events.md b/src/guide/events.md
index 8b7f81b289..b6104cf059 100644
--- a/src/guide/events.md
+++ b/src/guide/events.md
@@ -171,7 +171,7 @@ To address this problem, Vue provides **event modifiers** for `v-on`. Recall tha
```
::: tip
-Order matters when using modifiers because the relevant code is generated in the same order. Therefore using `@click.prevent.self` will prevent **all clicks** while `@click.self.prevent` will only prevent clicks on the element itself.
+Order matters when using modifiers because the relevant code is generated in the same order. Therefore using `@click.prevent.self` will prevent **clicks default action on the element itself and its children** while `@click.self.prevent` will only prevent clicks default action on the element itself.
:::
```html
diff --git a/src/guide/forms.md b/src/guide/forms.md
index d32402cb2e..41571c86a3 100644
--- a/src/guide/forms.md
+++ b/src/guide/forms.md
@@ -269,10 +269,10 @@ By default, `v-model` syncs the input with the data after each `input` event (wi
If you want user input to be automatically typecast as a number, you can add the `number` modifier to your `v-model` managed inputs:
```html
-
+
```
-This is often useful, because even with `type="number"`, the value of HTML input elements always returns a string. If the value cannot be parsed with `parseFloat()`, then the original value is returned.
+This is often useful when the input type is `text`. If the input type is `number`, Vue can automatically convert the raw string value to a number, and you don't need to add the `.number` modifier to `v-model`. If the value cannot be parsed with `parseFloat()`, then the original value is returned.
### `.trim`
diff --git a/src/guide/installation.md b/src/guide/installation.md
index f6c7adeaa6..7cd93128a8 100644
--- a/src/guide/installation.md
+++ b/src/guide/installation.md
@@ -18,7 +18,7 @@ Detailed release notes for each version are available on [GitHub](https://github
## Vue Devtools
> Currently in Beta - Vuex and Router integration is still WIP
-
+
Learn how to install and use Vue Devtools in a free Vue School lesson
When using Vue, we recommend also installing the [Vue Devtools](https://github.com/vuejs/vue-devtools#vue-devtools) in your browser, allowing you to inspect and debug your Vue applications in a more user-friendly interface.
@@ -68,7 +68,7 @@ In most cases, the preferred way to create a webpack build with minimal configur
## CLI
-Vue provides an [official CLI](https://github.com/vuejs/vue-cli) for quickly scaffolding ambitious Single Page Applications. It provides batteries-included build setups for a modern frontend workflow. It takes only a few minutes to get up and running with hot-reload, lint-on-save, and production-ready builds. See [the Vue CLI docs](https://cli.vuejs.org) for more details.
+Vue provides an [official CLI](https://cli.vuejs.org/) for quickly scaffolding ambitious Single Page Applications. It provides batteries-included build setups for a modern frontend workflow. It takes only a few minutes to get up and running with hot-reload, lint-on-save, and production-ready builds.
::: tip
The CLI assumes prior knowledge of Node.js and the associated build tools. If you are new to Vue or front-end build tools, we strongly suggest going through [the guide](./introduction.html) without any build tools before using the CLI.
@@ -90,7 +90,7 @@ vue upgrade --next
## Vite
-[Vite](https://github.com/vitejs/vite) is a web development build tool that allows for lightning fast serving of code due to its native ES Module import approach.
+[Vite](https://vitejs.dev/) is a web development build tool that allows for lightning fast serving of code due to its native ES Module import approach.
Vue projects can quickly be set up with Vite by running the following commands in your terminal.
@@ -117,6 +117,15 @@ $ yarn
$ yarn dev
```
+Or with pnpm:
+
+```bash
+$ pnpm create vite -- --template vue
+$ cd
+$ pnpm install
+$ pnpm dev
+```
+
## Explanation of Different Builds
In the [`dist/` directory of the npm package](https://cdn.jsdelivr.net/npm/vue@3.0.2/dist/) you will find many different builds of Vue.js. Here is an overview of which `dist` file should be used depending on the use-case.
@@ -138,7 +147,7 @@ Global builds are not [UMD](https://github.com/umdjs/umd) builds. They are built
#### `vue(.runtime).esm-browser(.prod).js`:
-- For usage via native ES modules imports (in browser via `
```
-While this seems like a convenience, it requires a custom syntax that breaks the assumption of expressions inside of curly braces being "just JavaScript," which has both learning and implementation costs.
+While this seems like a convenience, it requires a custom syntax that breaks the assumption of expressions inside curly braces being "just JavaScript," which has both learning and implementation costs.
## 3.x Update
diff --git a/src/guide/migration/global-api-treeshaking.md b/src/guide/migration/global-api-treeshaking.md
index d730cf71e6..502a272334 100644
--- a/src/guide/migration/global-api-treeshaking.md
+++ b/src/guide/migration/global-api-treeshaking.md
@@ -107,7 +107,7 @@ export function render() {
This essentially means the `Transition` component only gets imported when the application actually makes use of it. In other words, if the application doesn’t have any `` component, the code supporting this feature will not be present in the final bundle.
-With global tree-shaking, the user only “pay” for the features they actually use. Even better, knowing that optional features won't increase the bundle size for applications not using them, framework size has become much less a concern for additional core features in the future, if at all.
+With global tree-shaking, the users only “pay” for the features they actually use. Even better, knowing that optional features won't increase the bundle size for applications not using them, framework size has become much less a concern for additional core features in the future, if at all.
::: warning Important
The above only applies to the [ES Modules builds](/guide/installation.html#explanation-of-different-builds) for use with tree-shaking capable bundlers - the UMD build still includes all features and exposes everything on the Vue global variable (and the compiler will produce appropriate output to use APIs off the global instead of importing).
diff --git a/src/guide/migration/introduction.md b/src/guide/migration/introduction.md
index 6090a3e947..d86c317795 100644
--- a/src/guide/migration/introduction.md
+++ b/src/guide/migration/introduction.md
@@ -93,7 +93,7 @@ The following consists a list of breaking changes from 2.x:
### Custom Elements
- [Custom element checks are now performed during template compilation](/guide/migration/custom-elements-interop.html)
-- [Special `is` prop usage is restricted to the reserved `` tag only](/guide/migration/custom-elements-interop.html#customized-built-in-elements)
+- [Special `is` attribute usage is restricted to the reserved `` tag only](/guide/migration/custom-elements-interop.html#customized-built-in-elements)
### Other Minor Changes
@@ -162,11 +162,11 @@ We are working on a new version of the Devtools with a new UI and refactored int
- Note: the beta channel may conflict with the stable version of devtools so you may need to temporarily disable the stable version for the beta channel to work properly.
-- For Firefox: [Download the signed extension](https://github.com/vuejs/vue-devtools/releases/tag/v6.0.0-beta.2) (`.xpi` file under Assets)
+- For Firefox: [Download the signed extension](https://github.com/vuejs/vue-devtools/releases/tag/v6.0.0-beta.20) (`.xpi` file under Assets)
### IDE Support
-It is recommended to use [VSCode](https://code.visualstudio.com/) with our official extension [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur), which provides comprehensive IDE support for Vue 3.
+It is recommended to use [VSCode](https://code.visualstudio.com/) with our official extension [Volar](https://github.com/johnsoncodehk/volar), which provides comprehensive IDE support for Vue 3.
### Other Projects
diff --git a/src/guide/migration/key-attribute.md b/src/guide/migration/key-attribute.md
index 34bdf73f58..7042e07150 100644
--- a/src/guide/migration/key-attribute.md
+++ b/src/guide/migration/key-attribute.md
@@ -3,7 +3,7 @@ badges:
- breaking
---
-# `key` attribute
+# `key` Attribute
## Overview
diff --git a/src/guide/migration/migration-build.md b/src/guide/migration/migration-build.md
index 262558ebef..54fe9edd11 100644
--- a/src/guide/migration/migration-build.md
+++ b/src/guide/migration/migration-build.md
@@ -20,7 +20,7 @@ While we've tried hard to make the migration build mimic Vue 2 behavior as much
- Internet Explorer 11 support: [Vue 3 has officially dropped the plan for IE11 support](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0038-vue3-ie11-support.md). If you still need to support IE11 or below, you will have to stay on Vue 2.
-- Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/vue-next/tree/master/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://vitejs.dev/guide/ssr.html). If you are using [Nuxt.js](https://nuxtjs.org/), it is probably better to wait for Nuxt 3.
+- Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/vue-next/tree/master/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://vitejs.dev/guide/ssr.html). If you are using [Nuxt.js](https://nuxtjs.org/), you can try [Nuxt Bridge, a Nuxt.js 2 to 3 compatibility layer](https://v3.nuxtjs.org/getting-started/bridge/). For complex, production projects, it is probably best to wait for [Nuxt 3 (currently in beta)](https://v3.nuxtjs.org/getting-started/introduction).
### Expectations
@@ -155,11 +155,22 @@ The following workflow walks through the steps of migrating an actual Vue 2 app
-4. At this point, your application may encounter some compile-time errors / warnings (e.g. use of filters). Fix them first. If all compiler warnings are gone, you can also set the compiler to Vue 3 mode.
+4. If you are using TypeScript, you will also need to modify `vue`'s typing to expose the default export (which is no longer present in Vue 3) by adding a `*.d.ts` file with the following:
+
+ ```ts
+ declare module 'vue' {
+ import { CompatVue } from '@vue/runtime-dom'
+ const Vue: CompatVue
+ export default Vue
+ export * from '@vue/runtime-dom'
+ }
+ ```
+
+5. At this point, your application may encounter some compile-time errors / warnings (e.g. use of filters). Fix them first. If all compiler warnings are gone, you can also set the compiler to Vue 3 mode.
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/b05d9555f6e115dea7016d7e5a1a80e8f825be52)
-5. After fixing the errors, the app should be able to run if it is not subject to the [limitations](#known-limitations) mentioned above.
+6. After fixing the errors, the app should be able to run if it is not subject to the [limitations](#known-limitations) mentioned above.
You will likely see a LOT of warnings from both the command line and the browser console. Here are some general tips:
@@ -171,29 +182,29 @@ The following workflow walks through the steps of migrating an actual Vue 2 app
- If you are using `vue-router`, note `` and `` will not work with `` until you upgrade to `vue-router` v4.
-6. Update [`` class names](/guide/migration/transition.html). This is the only feature that does not have a runtime warning. You can do a project-wide search for `.*-enter` and `.*-leave` CSS class names.
+7. Update [`` class names](/guide/migration/transition.html). This is the only feature that does not have a runtime warning. You can do a project-wide search for `.*-enter` and `.*-leave` CSS class names.
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/d300103ba622ae26ac26a82cd688e0f70b6c1d8f)
-7. Update app entry to use [new global mounting API](/guide/migration/global-api.html#a-new-global-api-createapp).
+8. Update app entry to use [new global mounting API](/guide/migration/global-api.html#a-new-global-api-createapp).
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/a6e0c9ac7b1f4131908a4b1e43641f608593f714)
-8. [Upgrade `vuex` to v4](https://next.vuex.vuejs.org/guide/migrating-to-4-0-from-3-x.html).
+9. [Upgrade `vuex` to v4](https://next.vuex.vuejs.org/guide/migrating-to-4-0-from-3-x.html).
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/5bfd4c61ee50f358cd5daebaa584f2c3f91e0205)
-9. [Upgrade `vue-router` to v4](https://next.router.vuejs.org/guide/migration/index.html). If you also use `vuex-router-sync`, you can replace it with a store getter.
+10. [Upgrade `vue-router` to v4](https://next.router.vuejs.org/guide/migration/index.html). If you also use `vuex-router-sync`, you can replace it with a store getter.
- After the upgrade, to use `` and `` with `` requires using the new [scoped-slot based syntax](https://next.router.vuejs.org/guide/migration/index.html#router-view-keep-alive-and-transition).
+ After the upgrade, to use `` and `` with `` requires using the new [scoped-slot based syntax](https://next.router.vuejs.org/guide/migration/index.html#router-view-keep-alive-and-transition).
- [Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/758961e73ac4089890079d4ce14996741cf9344b)
+ [Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/758961e73ac4089890079d4ce14996741cf9344b)
-10. Pick off individual warnings. Note some features have conflicting behavior between Vue 2 and Vue 3 - for example, the render function API, or the functional component vs. async component change. To migrate to Vue 3 API without affecting the rest of the application, you can opt-in to Vue 3 behavior on a per-component basis with the [`compatConfig` option](#per-component-config).
+11. Pick off individual warnings. Note some features have conflicting behavior between Vue 2 and Vue 3 - for example, the render function API, or the functional component vs. async component change. To migrate to Vue 3 API without affecting the rest of the application, you can opt-in to Vue 3 behavior on a per-component basis with the [`compatConfig` option](#per-component-config).
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/d0c7d3ae789be71b8fd56ce79cb4cb1f921f893b)
-11. When all warnings are fixed, you can remove the migration build and switch to Vue 3 proper. Note you may not be able to do so if you still have dependencies that rely on Vue 2 behavior.
+12. When all warnings are fixed, you can remove the migration build and switch to Vue 3 proper. Note you may not be able to do so if you still have dependencies that rely on Vue 2 behavior.
[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/9beb45490bc5f938c9e87b4ac1357cfb799565bd)
diff --git a/src/guide/migration/transition-group.md b/src/guide/migration/transition-group.md
index e6ca6ae29c..4137ae4d5f 100644
--- a/src/guide/migration/transition-group.md
+++ b/src/guide/migration/transition-group.md
@@ -8,11 +8,11 @@ badges:
## Overview
-`` no longer renders a root element by default, but can still create one with the `tag` prop.
+`` no longer renders a root element by default, but can still create one with the `tag` attribute.
## 2.x Syntax
-In Vue 2, ``, like other custom components, needed a root element, which by default was a `` but was customizable via the `tag` prop.
+In Vue 2, ``, like other custom components, needed a root element, which by default was a `` but was customizable via the `tag` attribute.
```html
@@ -26,7 +26,7 @@ In Vue 2, ``, like other custom components, needed a root elem
In Vue 3, we have [fragment support](/guide/migration/fragments.html), so components no longer _need_ a root node. Consequently, `` no longer renders one by default.
-- If you already have the `tag` prop defined in your Vue 2 code, like in the example above, everything will work as before
+- If you already have the `tag` attribute defined in your Vue 2 code, like in the example above, everything will work as before
- If you didn't have one defined _and_ your styling or other behaviors relied on the presence of the `` root element to work properly, simply add `tag="span"` to the ``:
```html
diff --git a/src/guide/migration/v-bind.md b/src/guide/migration/v-bind.md
index c5acdb82aa..902e2ce4cb 100644
--- a/src/guide/migration/v-bind.md
+++ b/src/guide/migration/v-bind.md
@@ -12,11 +12,11 @@ badges:
## Introduction
-When dynamically binding attributes on an element, a common scenario involves using both the `v-bind="object"` syntax as well as individual properties in the same element. However, this raises questions as far as the priority of merging.
+When dynamically binding attributes on an element, a common scenario involves using both the `v-bind="object"` syntax as well as individual attributes in the same element. However, this raises questions as far as the priority of merging.
## 2.x Syntax
-In 2.x, if an element has both `v-bind="object"` and an identical individual property defined, the individual property would always overwrite bindings in the `object`.
+In 2.x, if an element has both `v-bind="object"` and an identical individual attribute defined, the individual attribute would always overwrite bindings in the `object`.
```html
@@ -27,7 +27,7 @@ In 2.x, if an element has both `v-bind="object"` and an identical individual pro
## 3.x Syntax
-In 3x, if an element has both `v-bind="object"` and an identical individual property defined, the order of how the bindings are declared determines how they are merged. In other words, rather than assuming developers want the individual property to always override what is defined in the `object`, developers now have more control over the desired merging behavior.
+In 3x, if an element has both `v-bind="object"` and an identical individual attribute defined, the order of how the bindings are declared determines how they are merged. In other words, rather than assuming developers want the individual attribute to always override what is defined in the `object`, developers now have more control over the desired merging behavior.
```html
@@ -43,6 +43,6 @@ In 3x, if an element has both `v-bind="object"` and an identical individual prop
## Migration Strategy
-If you are relying on this override functionality for `v-bind`, we currently recommend ensuring that your `v-bind` attribute is defined before individual properties.
+If you are relying on this override functionality for `v-bind`, we currently recommend ensuring that your `v-bind` attribute is defined before individual attributes.
[Migration build flag: `COMPILER_V_BIND_OBJECT_ORDER`](migration-build.html#compat-configuration)
diff --git a/src/guide/migration/v-model.md b/src/guide/migration/v-model.md
index 680bc5d005..928a2b3169 100644
--- a/src/guide/migration/v-model.md
+++ b/src/guide/migration/v-model.md
@@ -86,7 +86,7 @@ Then the parent could listen to that event and update a local data property, if
```
-For convenience, we had a shorthand for this pattern with the .sync modifier:
+For convenience, we had a shorthand for this pattern with the `.sync` modifier:
```html
diff --git a/src/guide/migration/vnode-lifecycle-events.md b/src/guide/migration/vnode-lifecycle-events.md
index 25202ae338..8ad0b231b9 100644
--- a/src/guide/migration/vnode-lifecycle-events.md
+++ b/src/guide/migration/vnode-lifecycle-events.md
@@ -31,7 +31,7 @@ In Vue 3, the event name is prefixed with `vnode-`:
```
-Or just `vnode` if you're using camel case:
+Or just `vnode` if you're using camelCase:
```html
diff --git a/src/guide/migration/watch.md b/src/guide/migration/watch.md
index 0b155ac6f8..56d93be663 100644
--- a/src/guide/migration/watch.md
+++ b/src/guide/migration/watch.md
@@ -27,6 +27,6 @@ watch: {
## Migration Strategy
-If you rely on watching array mutations, add the `deep` property to ensure that your callback is triggered correctly.
+If you rely on watching array mutations, add the `deep` option to ensure that your callback is triggered correctly.
[Migration build flag: `WATCH_ARRAY`](migration-build.html#compat-configuration)
diff --git a/src/guide/reactivity-fundamentals.md b/src/guide/reactivity-fundamentals.md
index baddc43a41..bbaef88a95 100644
--- a/src/guide/reactivity-fundamentals.md
+++ b/src/guide/reactivity-fundamentals.md
@@ -1,5 +1,7 @@
# Reactivity Fundamentals
+> This section uses [single-file component](single-file-component.html) syntax for code examples
+
## Declaring Reactive State
To create a reactive state from a JavaScript object, we can use a `reactive` method:
diff --git a/src/guide/render-function.md b/src/guide/render-function.md
index fda002f2e2..902f229421 100644
--- a/src/guide/render-function.md
+++ b/src/guide/render-function.md
@@ -350,7 +350,7 @@ render() {
#### Event Modifiers
-For the `.passive`, `.capture`, and `.once` event modifiers, they can be concatenated after the event name using camel case.
+For the `.passive`, `.capture`, and `.once` event modifiers, they can be concatenated after the event name using camelCase.
For example:
diff --git a/src/guide/single-file-component.md b/src/guide/single-file-component.md
index 5078f7823a..595fc444a4 100644
--- a/src/guide/single-file-component.md
+++ b/src/guide/single-file-component.md
@@ -1,5 +1,7 @@
# Single File Components
+Learn about single file components with a free video lesson on Vue School
+
## Introduction
Vue Single File Components (aka `*.vue` files, abbreviated as **SFC**) is a special file format that allows us to encapsulate the template, logic, **and** styling of a Vue component in a single file. Here's an example SFC:
@@ -73,7 +75,7 @@ SFC is a defining feature of Vue as a framework, and is the recommended approach
- Static Site Generation (SSG)
- Any non-trivial frontends where a build step can be justified for better development experience (DX).
-That said, we do realize there are scenarios where SFCs can feel like overkill. This is why Vue can still be used via plain JavaScript without a build step. If you are just looking for enhancing largely static HTML with light interactions, you can also check out [petite-vue](https://github.com/vuejs/petite-vue), a 5kb subset of Vue optimized for progressive enhancement.
+That said, we do realize there are scenarios where SFCs can feel like overkill. This is why Vue can still be used via plain JavaScript without a build step. If you are just looking for enhancing largely static HTML with light interactions, you can also check out [petite-vue](https://github.com/vuejs/petite-vue), a 6kb subset of Vue optimized for progressive enhancement.
## What About Separation of Concerns?
diff --git a/src/guide/ssr/introduction.md b/src/guide/ssr/introduction.md
index 86a50a4142..b8a1ee1c92 100644
--- a/src/guide/ssr/introduction.md
+++ b/src/guide/ssr/introduction.md
@@ -40,7 +40,7 @@ If you're using [webpack](https://webpack.js.org/), you can add prerendering wit
This guide will be very in-depth and assumes you are already familiar with Vue.js itself, and have a decent working knowledge of Node.js and webpack.
-[//]: # 'If you prefer a higher-level solution that provides a smooth out-of-the-box experience, you should probably give [Nuxt.js](https://nuxtjs.org/) a try. It's built upon the same Vue stack but abstracts away a lot of the boilerplate, and provides some extra features such as static site generation. However, it may not suit your use case if you need more direct control of your app's structure. Regardless, it would still be beneficial to read through this guide to understand better how things work together.'
+If you prefer a higher-level solution that provides a smooth out-of-the-box experience, you should probably give [Nuxt.js](https://nuxtjs.org/) a try. It's built upon the same Vue stack but abstracts away a lot of the boilerplate, and provides some extra features such as static site generation. However, it may not suit your use case if you need more direct control of your app's structure. Regardless, it would still be beneficial to read through this guide to understand better how things work together.
[//]: # 'TODO: As you read along, it would be helpful to refer to the official [HackerNews Demo](https://github.com/vuejs/vue-hackernews-2.0/), which makes use of most of the techniques covered in this guide'
diff --git a/src/guide/ssr/routing.md b/src/guide/ssr/routing.md
index 943bf1389e..e78314bed9 100644
--- a/src/guide/ssr/routing.md
+++ b/src/guide/ssr/routing.md
@@ -8,31 +8,50 @@ It is recommended to use the official [vue-router](https://github.com/vuejs/vue-
```js
// router.js
-import { createRouter, createMemoryHistory, createWebHistory } from 'vue-router'
+import { createRouter } from 'vue-router'
import MyUser from './components/MyUser.vue'
-const isServer = typeof window === 'undefined'
-
-const history = isServer ? createMemoryHistory() : createWebHistory()
-
const routes = [{ path: '/user', component: MyUser }]
-export default function() {
- return createRouter({ routes, history })
+export default function (history) {
+ return createRouter({
+ history,
+ routes
+ })
}
```
-And update our `app.js`, client and server entries:
+And update our client and server entries:
```js
-// app.js
+// entry-client.js
+import { createSSRApp } from 'vue'
+import { createWebHistory } from 'vue-router'
+import createRouter from './router.js'
+import App from './App.vue'
+
+// ...
+
+const app = createSSRApp(App)
+
+const router = createRouter(createWebHistory())
+
+app.use(router)
+
+// ...
+```
+
+```js
+// entry-server.js
import { createSSRApp } from 'vue'
+// server router uses a different history from the client one
+import { createMemoryHistory } from 'vue-router'
+import createRouter from './router.js'
import App from './App.vue'
-import createRouter from './router'
-export default function(args) {
+export default function () {
const app = createSSRApp(App)
- const router = createRouter()
+ const router = createRouter(createMemoryHistory())
app.use(router)
@@ -43,20 +62,6 @@ export default function(args) {
}
```
-```js
-// entry-client.js
-const { app, router } = createApp({
- /*...*/
-})
-```
-
-```js
-// entry-server.js
-const { app, router } = createApp({
- /*...*/
-})
-```
-
## Code-Splitting
Code-splitting, or lazy-loading part of your app, helps reduce the size of assets that need to be downloaded by the browser for the initial render, and can greatly improve TTI (time-to-interactive) for apps with large bundles. The key is "loading just what is needed" for the initial screen.
@@ -74,15 +79,20 @@ const routes = [
]
```
-On both client and server we need to wait for router to resolve async route components ahead of time in order to properly invoke in-component hooks. For this we will be using [router.isReady](https://next.router.vuejs.org/api/#isready) method Let's update our client entry:
+On both client and server we need to wait for the router to resolve async route components ahead of time in order to properly invoke in-component hooks. For this we will be using the [router.isReady](https://next.router.vuejs.org/api/#isready) method. Let's update our client entry:
```js
// entry-client.js
-import createApp from './app'
+import { createSSRApp } from 'vue'
+import { createWebHistory } from 'vue-router'
+import createRouter from './router.js'
+import App from './App.vue'
-const { app, router } = createApp({
- /* ... */
-})
+const app = createSSRApp(App)
+
+const router = createRouter(createWebHistory())
+
+app.use(router)
router.isReady().then(() => {
app.mount('#app')
diff --git a/src/guide/ssr/server.md b/src/guide/ssr/server.md
index 0a8b304c04..8f38e7d4ce 100644
--- a/src/guide/ssr/server.md
+++ b/src/guide/ssr/server.md
@@ -2,13 +2,14 @@
The [code structure](./structure.html) and [webpack configuration](./build-config.html) we've described also require some changes to our Express server code.
-- we need to create an application with a built `app.js` from the resulting bundle. A path to it can be found using the webpack manifest:
+- we need to create an application with a built `entry-server.js` from the resulting bundle. A path to it can be found using the webpack manifest:
```js
// server.js
const path = require('path')
const manifest = require('./dist/server/ssr-manifest.json')
+ // the 'app.js' name is taken from the name of the entrypoint with an added `.js` postfix
const appPath = path.join(__dirname, './dist', 'server', manifest['app.js'])
const createApp = require(appPath).default
```
@@ -78,7 +79,7 @@ server.use(
)
server.get('*', async (req, res) => {
- const { app } = await createApp()
+ const { app } = createApp()
const appContent = await renderToString(app)
diff --git a/src/guide/ssr/structure.md b/src/guide/ssr/structure.md
index 1fe86d676a..0a938039cd 100644
--- a/src/guide/ssr/structure.md
+++ b/src/guide/ssr/structure.md
@@ -4,11 +4,40 @@
When writing client-only code, we can assume that our code will be evaluated in a fresh context every time. However, a Node.js server is a long-running process. When our code is first imported by the process, it will be evaluated once and then stay in memory. This means that if you create a singleton object, it will be shared between every incoming request, with the risk of cross-request state pollution.
+```js
+// bad
+import app from './app.js'
+
+server.get('*', async (req, res) => {
+ // the app is now shared amongst all users
+ const result = await renderToString(app)
+ // ...
+})
+```
+
+```js
+// good
+function createApp() {
+ return createSSRApp(/* ... */)
+}
+
+server.get('*', async (req, res) => {
+ // each user gets its own app
+ const app = createApp()
+ const result = await renderToString(app)
+ // ...
+})
+```
+
Therefore, we need to **create a new root Vue instance for each request.** In order to do that, we need to write a factory function that can be repeatedly executed to create fresh app instances for each request:
```js
-// app.js
+// server.js
const { createSSRApp } = require('vue')
+const { renderToString } = require('@vue/server-renderer')
+const express = require('express')
+
+const server = express()
function createApp() {
return createSSRApp({
@@ -20,15 +49,6 @@ function createApp() {
template: `Current user is: {{ user }}
`
})
}
-```
-
-And our server code now becomes:
-
-```js
-// server.js
-const { renderToString } = require('@vue/server-renderer')
-const server = require('express')()
-const { createApp } = require('src/app.js')
server.get('*', async (req, res) => {
const app = createApp()
@@ -49,7 +69,7 @@ server.get('*', async (req, res) => {
server.listen(8080)
```
-The same rule applies to other instances as well (such as the router or store). Instead of exporting the router or store directly from a module and importing it across your app, you should create a fresh instance in `createApp` and inject it from the root Vue instance.
+The same rule applies to other instances as well (such as the router or store). Instead of exporting the router or store directly from a module and importing it across your app, you should create a fresh instance in `createApp` and inject it from the root Vue instance each time a new request is made.
## Introducing a Build Step
@@ -76,42 +96,43 @@ src
├── components
│ ├── MyUser.vue
│ └── MyTable.vue
-├── App.vue
-├── app.js # universal entry
+├── App.vue # the root of your application
├── entry-client.js # runs in browser only
└── entry-server.js # runs on server only
```
-### `app.js`
+### `App.vue`
-`app.js` is the universal entry to our app. In a client-only app, we would create the Vue application instance right in this file and mount directly to DOM. However, for SSR that responsibility is moved into the client-only entry file. `app.js` instead creates an application instance and exports it:
+You may have noticed we now have a file called `App.vue` in the root of our `src` folder. That's where the root component of your application will be stored. We can now safely move the application code from `server.js` to the `App.vue` file:
-```js
-import { createSSRApp } from 'vue'
-import App from './App.vue'
-
-// export a factory function for creating a root component
-export default function(args) {
- const app = createSSRApp(App)
+```vue
+
+ Current user is: {{ user }}
+
- return {
- app
+
```
### `entry-client.js`
-The client entry creates the application using the root component factory and mounts it to the DOM:
+The client entry creates the application using the `App.vue` component and mounts it to the DOM:
```js
-import createApp from './app'
+import { createSSRApp } from 'vue'
+import App from './App.vue'
// client-specific bootstrapping logic...
-const { app } = createApp({
- // here we can pass additional arguments to app factory
-})
+const app = createSSRApp(App)
// this assumes App.vue template root element has `id="app"`
app.mount('#app')
@@ -122,12 +143,11 @@ app.mount('#app')
The server entry uses a default export which is a function that can be called repeatedly for each render. At this moment, it doesn't do much other than returning the app instance - but later we will perform server-side route matching and data pre-fetching logic here.
```js
-import createApp from './app'
+import { createSSRApp } from 'vue'
+import App from './App.vue'
-export default function() {
- const { app } = createApp({
- /*...*/
- })
+export default function () {
+ const app = createSSRApp(App)
return {
app
diff --git a/src/guide/template-syntax.md b/src/guide/template-syntax.md
index 9b2c55a555..bcb024e00b 100644
--- a/src/guide/template-syntax.md
+++ b/src/guide/template-syntax.md
@@ -26,7 +26,7 @@ You can also perform one-time interpolations that do not update on data change b
### Raw HTML
-The double mustaches interprets the data as plain text, not HTML. In order to output real HTML, you will need to use the [`v-html` directive](../api/directives.html#v-html):
+The double mustaches interpret the data as plain text, not HTML. In order to output real HTML, you will need to use the [`v-html` directive](../api/directives.html#v-html):
```html
Using mustaches: {{ rawHtml }}
@@ -38,7 +38,7 @@ The double mustaches interprets the data as plain text, not HTML. In order to ou
The contents of the `span` will be replaced with the value of the `rawHtml` property, interpreted as plain HTML - data bindings are ignored. Note that you cannot use `v-html` to compose template partials, because Vue is not a string-based templating engine. Instead, components are preferred as the fundamental unit for UI reuse and composition.
::: tip
-Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS vulnerabilities](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use HTML interpolation on trusted content and **never** on user-provided content
+Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS vulnerabilities](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use HTML interpolation on trusted content and **never** on user-provided content.
:::
### Attributes
@@ -145,7 +145,7 @@ You'll see other examples of modifiers later, [for `v-on`](events.md#event-modif
## Shorthands
-The `v-` prefix serves as a visual cue for identifying Vue-specific attributes in your templates. This is useful when you are using Vue.js to apply dynamic behavior to some existing markup, but can feel verbose for some frequently used directives. At the same time, the need for the `v-` prefix becomes less important when you are building a [SPA](https://en.wikipedia.org/wiki/Single-page_application), where Vue manages every template. Therefore, Vue provides special shorthands for two of the most often used directives, `v-bind` and `v-on`:
+The `v-` prefix serves as a visual cue for identifying Vue-specific attributes in your templates. This is useful when you are using Vue.js to apply dynamic behavior to some existing markup, but can feel verbose for some frequently used directives. At the same time, the need for the `v-` prefix becomes less important when you are building an [SPA](https://en.wikipedia.org/wiki/Single-page_application), where Vue manages every template. Therefore, Vue provides special shorthands for two of the most often used directives, `v-bind` and `v-on`:
### `v-bind` Shorthand
diff --git a/src/guide/transitions-overview.md b/src/guide/transitions-overview.md
index eb98a33ee0..ee20b1c262 100644
--- a/src/guide/transitions-overview.md
+++ b/src/guide/transitions-overview.md
@@ -176,7 +176,7 @@ Easing can also convey the quality of material being animated. Take this pen for
-You can get a lot of unique effects and make your animation very stylish by adjusting your easing. CSS allows you to modify this by adjusting a cubic bezier property, [this playground](https://cubic-bezier.com/#.17,.67,.83,.67) by Lea Verou is very helpful for exploring this.
+You can get a lot of unique effects and make your animation very stylish by adjusting your easing. CSS allows you to modify this by adjusting the cubic-bezier function's parameters, [this playground](https://cubic-bezier.com/#.17,.67,.83,.67) by Lea Verou is very helpful for exploring this.
Though you can achieve great effects for simple animation with the two handles the cubic-bezier ease offers, JavaScript allows multiple handles, and therefore, allows for much more variance.
diff --git a/src/guide/typescript-support.md b/src/guide/typescript-support.md
index 8038704762..c8363a08ef 100644
--- a/src/guide/typescript-support.md
+++ b/src/guide/typescript-support.md
@@ -88,7 +88,7 @@ Or, if you want to combine TypeScript with a [JSX `render` function](/guide/rend
For developing Vue applications with TypeScript, we strongly recommend using [Visual Studio Code](https://code.visualstudio.com/), which provides great out-of-the-box support for TypeScript. If you are using [single-file components](./single-file-component.html) (SFCs), get the awesome [Volar extension](https://github.com/johnsoncodehk/volar), which provides TypeScript inference inside SFCs and many other great features.
-[WebStorm](https://www.jetbrains.com/webstorm/) also provides out-of-the-box support for both TypeScript and Vue.
+[WebStorm](https://www.jetbrains.com/webstorm/) provides out of the box support for both TypeScript and Vue. Other JetBrains IDEs also support them, either out of the box or via [this free plugin](https://plugins.jetbrains.com/plugin/9442-vue-js).
## Defining Vue Components
diff --git a/src/guide/web-components.md b/src/guide/web-components.md
index e75cfd91ce..be4d3de86f 100644
--- a/src/guide/web-components.md
+++ b/src/guide/web-components.md
@@ -14,6 +14,14 @@ By default, Vue will attempt to resolve a non-native HTML tag as a registered Vu
If you are using Vue with a build setup, the option should be passed via build configs since it is a compile-time option.
+#### Example In-Browser Config
+
+```js
+// Only works if using in-browser compilation.
+// If using build tools, see config examples below.
+app.config.compilerOptions.isCustomElement = tag => tag.includes('-')
+```
+
#### Example Vite Config
```js
@@ -44,7 +52,7 @@ module.exports = {
.rule('vue')
.use('vue-loader')
.tap(options => ({
- ...options
+ ...options,
compilerOptions: {
// treat any tag that starts with ion- as custom elements
isCustomElement: tag => tag.startsWith('ion-')
@@ -112,7 +120,7 @@ document.body.appendChild(
- When the element's `disconnectedCallback` is invoked, Vue will check whether the element is detached from the document after a microtask tick.
- - If the element is still in the document, it's a move and the component instance will be perserved;
+ - If the element is still in the document, it's a move and the component instance will be preserved;
- If the element is detached from the document, it's a removal and the component instance will be unmounted.
@@ -200,7 +208,7 @@ It is recommended to export the individual element constructors to give your use
```js
import { defineCustomElement } from 'vue'
import Foo from './MyFoo.ce.vue'
-import Bar from './MyBar.ce.bar'
+import Bar from './MyBar.ce.vue'
const MyFoo = defineCustomElement(Foo)
const MyBar = defineCustomElement(Bar)
diff --git a/src/style-guide/README.md b/src/style-guide/README.md
index 4dd04b91f2..e337e82cdc 100644
--- a/src/style-guide/README.md
+++ b/src/style-guide/README.md
@@ -1284,6 +1284,7 @@ This is the default order we recommend for component options. They're split into
- `inheritAttrs`
- `props`
- `emits`
+ - `expose`
6. **Composition API** (the entry point for using the Composition API)
- `setup`
@@ -1484,7 +1485,7 @@ Prefer class selectors over element selectors in `scoped` styles, because large
::: details Detailed Explanation
To scope styles, Vue adds a unique attribute to component elements, such as `data-v-f3f3eg9`. Then selectors are modified so that only matching elements with this attribute are selected (e.g. `button[data-v-f3f3eg9]`).
-The problem is that large numbers of [element-attribute selectors](http://stevesouders.com/efws/css-selectors/csscreate.php?n=1000&sel=a%5Bhref%5D&body=background%3A+%23CFD&ne=1000) (e.g. `button[data-v-f3f3eg9]`) will be considerably slower than [class-attribute selectors](http://stevesouders.com/efws/css-selectors/csscreate.php?n=1000&sel=.class%5Bhref%5D&body=background%3A+%23CFD&ne=1000) (e.g. `.btn-close[data-v-f3f3eg9]`), so class selectors should be preferred whenever possible.
+The problem is that large numbers of element-attribute selectors (e.g. `button[data-v-f3f3eg9]`) will be considerably slower than class-attribute selectors (e.g. `.btn-close[data-v-f3f3eg9]`), so class selectors should be preferred whenever possible.
:::
diff --git a/yarn.lock b/yarn.lock
index 2105db2d43..761d82b5e8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3742,9 +3742,9 @@ flush-write-stream@^1.0.0:
readable-stream "^2.3.6"
follow-redirects@^1.0.0:
- version "1.13.1"
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
- integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==
+ version "1.14.7"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
+ integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
for-in@^1.0.2:
version "1.0.2"
@@ -6280,9 +6280,9 @@ pretty-time@^1.1.0:
integrity sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==
prismjs@^1.13.0:
- version "1.24.0"
- resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.24.0.tgz#0409c30068a6c52c89ef7f1089b3ca4de56be2ac"
- integrity sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ==
+ version "1.25.0"
+ resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.25.0.tgz#6f822df1bdad965734b310b315a23315cf999756"
+ integrity sha512-WCjJHl1KEWbnkQom1+SzftbtXMKQoezOCYs5rECqMN+jP+apI7ftoflyqigqzopSO3hMhTEb0mFClA8lkolgEg==
process-nextick-args@~2.0.0:
version "2.0.1"