File tree Expand file tree Collapse file tree 6 files changed +19
-9
lines changed
.vuepress/theme/components Expand file tree Collapse file tree 6 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 85
85
box-sizing : border-box ;
86
86
border : 1px solid currentColor ;
87
87
appearance : none ;
88
+ cursor : pointer ;
88
89
}
89
90
}
90
91
</style >
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ import { defineAsyncComponent } from 'vue'
202
202
203
203
const AsyncComp = defineAsyncComponent ({
204
204
// ファクトリ関数
205
- loader : () => import (' ./Foo.vue' )
205
+ loader : () => import (' ./Foo.vue' ),
206
206
// 非同期コンポーネントが読み込み中に使うコンポーネント
207
207
loadingComponent: LoadingComponent,
208
208
// 読み込みが失敗したときに使うコンポーネント
Original file line number Diff line number Diff line change 10
10
11
11
ミックスインフックは提供された順番に呼び出され、コンポーネント自身のフックよりも前に呼び出されます。
12
12
13
+ ::: info
14
+ Vue 2 では、コンポーネントロジックの再利用可能なチャンクを作成するための主要なメカニズムがミックスインでした。Vue 3 では、引き続きミックスインがサポートされていますが、コンポーネント間でコードの再利用するには [ Composition API] ( /guide/composition-api-introduction.html ) が推奨されています。
15
+ :::
16
+
13
17
- ** 例:**
14
18
15
19
``` js
16
20
const mixin = {
17
- created : function () {
21
+ created () {
18
22
console .log (1 )
19
23
}
20
24
}
34
38
35
39
## extends
36
40
37
- - ** 型:** ` Object | Function `
41
+ - ** 型:** ` Object `
38
42
39
43
- ** 詳細:**
40
44
41
- 別のコンポーネントを宣言的に拡張できます(純粋なオプションオブジェクトまたはコンストラクタのどちらでも)。これは主に単一ファイルコンポーネント間の拡張を簡単にすることを目的としています。
45
+ あるコンポーネントを別のコンポーネントに拡張して、そのコンポーネントオプションを継承することができます。
46
+
47
+ 実装の観点からは、` extends ` は ` mixins ` とほとんど同じです。` extends ` で指定されたコンポーネントは、最初のミックスインであるかのように扱われます。
48
+
49
+ しかし、` extends ` と ` mixins ` は異なる意図を表現します。` mixins ` オプションは主に機能のチャンクを構成するために使われ、` extends ` は主に継承に関係しています。
42
50
43
- これは ` mixins ` に似ています 。
51
+ ` mixins ` と同様に、どのオプションも関連するマージ戦略を使ってマージされます 。
44
52
45
53
- ** 例:**
46
54
47
55
``` js
48
56
const CompA = { ... }
49
57
50
- // CompA を `Vue.extend` の呼び出しなしで拡張します
51
58
const CompB = {
52
59
extends: CompA,
53
60
...
Original file line number Diff line number Diff line change 9
9
10
10
コンポーネントのライフサイクルに合わせて、ディレクティブのフック関数の名称が変更されました。
11
11
12
+ 加えて、` expression ` 文字列は ` binding ` オブジェクトの一部として渡されなくなりました。
13
+
12
14
## 2.x での構文
13
15
14
16
Vue 2 では、以下のフックを使用して要素のライフサイクルをターゲットにしたカスタムディレクティブが作成していました。これらはすべてオプションです。
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ Vue 3 で注目すべきいくつかの新機能の次のとおりです。
54
54
- [ Emits Component Option] ( /guide/component-custom-events.html )
55
55
- カスタムレンダラを作るための [ ` @vue/runtime-core ` の ` createRenderer ` API] ( https://github.com/vuejs/vue-next/tree/master/packages/runtime-core )
56
56
- [ SFC での Composition API の Syntax Sugar (` <script setup> ` )] ( https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md ) <Badge text =" experimental " type =" warning " />
57
- - [ SFC でのステートドリブンな CSS Variables (` <style> ` の ` v-bind ` )] ( https://github.com/vuejs/rfcs/blob/style-vars-2 /active-rfcs/0000 -sfc-style-variables.md ) <Badge text =" experimental " type =" warning " />
57
+ - [ SFC でのステートドリブンな CSS Variables (` <style> ` の ` v-bind ` )] ( https://github.com/vuejs/rfcs/blob/master /active-rfcs/0043 -sfc-style-variables.md ) <Badge text =" experimental " type =" warning " />
58
58
- [ SFC での ` <style scoped> ` は、グローバルルールまたはスロットされたコンテンツのみを対象とするルールを含めることができるようになった] ( https://github.com/vuejs/rfcs/blob/master/active-rfcs/0023-scoped-styles-changes.md )
59
59
- [ Suspense] ( /guide/migration/suspense.html ) <Badge text =" experimental " type =" warning " />
60
60
@@ -100,7 +100,7 @@ Vue 3 で注目すべきいくつかの新機能の次のとおりです。
100
100
- ` destroyed ` ライフサイクルオプションの名前が ` unmounted ` に変更されました
101
101
- ` beforeDestroy ` ライフサイクルオプションの名前が ` beforeUnmount ` に変更されました
102
102
- [ Props の ` default ` ファクトリ関数は ` this ` コンテキストにアクセスできなくなりました] ( /guide/migration/props-default-this.html )
103
- - [ コンポーネントライフサイクルに合わせてカスタムディレクティブ API が変更されました ] ( /guide/migration/custom-directives.html )
103
+ - [ コンポーネントライフサイクルに合わせてカスタムディレクティブ API が変更され、 ` binding.expression ` が削除されました ] ( /guide/migration/custom-directives.html )
104
104
- [ ` data ` オプションは常に関数として宣言されることが必要になりました] ( /guide/migration/data-option.html )
105
105
- [ ミックスインの ` data ` オプションは浅くマージされるようになりました] ( /guide/migration/data-option.html#mixin-merge-behavior-change )
106
106
- [ 属性強制の戦略が変更されました] ( /guide/migration/attribute-coercion.html )
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ touch rollup.config.js
92
92
93
93
``` js
94
94
// サードパーティのプラグインをインポート
95
- import commonjs from ' rollup- plugin-commonjs'
95
+ import commonjs from ' @ rollup/ plugin-commonjs'
96
96
import VuePlugin from ' rollup-plugin-vue'
97
97
import pkg from ' ./package.json' // 名前を再利用するために package.json ファイルをインポート
98
98
You can’t perform that action at this time.
0 commit comments