diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js index af6106dce0..11c8164817 100644 --- a/src/.vuepress/config.js +++ b/src/.vuepress/config.js @@ -87,13 +87,14 @@ const sidebar = { title: 'Migration to Vue 3', collapsable: true, children: [ - 'migration', + 'migration/introduction', 'migration/global-api', 'migration/treeshaking', 'migration/v-model', 'migration/functional-components', 'migration/async-components', - 'migration/custom-directives' + 'migration/custom-directives', + 'migration/keycode-modifiers' ] }, { diff --git a/src/guide/migration.md b/src/guide/migration/introduction.md similarity index 92% rename from src/guide/migration.md rename to src/guide/migration/introduction.md index bf997a34d1..dfb67ef143 100644 --- a/src/guide/migration.md +++ b/src/guide/migration/introduction.md @@ -1,4 +1,4 @@ -# Migration +# Introduction > There's so much here! Does that mean 3.0 is completely different, I'll have to learn the basics all over again, and migrating will be practically impossible? @@ -38,6 +38,8 @@ It depends on a few factors: [//]: # 'TODO: still need to see where this lands' +## Overview + ### New Features Some of the new features to keep an eye on in Vue 3 include: @@ -47,3 +49,9 @@ Some of the new features to keep an eye on in Vue 3 include: - Fragments - [Emits Component Option](/guide/component-custom-events.html) - `createRenderer` API from `@vue/runtime-core` to create custom renderers + +### Breaking + +The following consists a list of breaking changes from v2: + +- **keyCode support as `v-on` modifiers.** For more information, [see in-depth explanation](/guides/migration/keycodes.html) diff --git a/src/guide/migration/keycode-modifiers.md b/src/guide/migration/keycode-modifiers.md new file mode 100644 index 0000000000..8c3a7519e5 --- /dev/null +++ b/src/guide/migration/keycode-modifiers.md @@ -0,0 +1,51 @@ +# KeyCode Modifiers + +## Overview + +Here is a quick summary of what has changed: + +- **BREAKING**: Using numbers, i.e. keyCodes, as `v-on` modifiers is no longer supported +- **BREAKING**: `config.keyCodes` is no longer supported + +## Previous Syntax + +In Vue 2, `keyCodes` were supported as a way to modify a `v-on` method. + +```html + + + + + +``` + +In addition, you could define your own aliases via the global `config.keyCodes` option. + +```js +Vue.config.keyCodes = { + f1: 112 +} +``` + +```html + + + + + +``` + +## Current Syntax + +Since [`KeyboardEvent.keyCode` has been deprecated](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode), it no longer makes sense for Vue 3 to continue supporting this as well. As a result, it is now recommended to use the kebab-case name for any key you want to use as a modifier. + +```html + + +``` + +As a result, this means that `config.keyCodes` is now also deprecated and will no longer be supported. + +## How to Migrate + +For those using `keyCode` in their codbase, we recommend converting them to their kebab-cased named equivalents.