質問編集履歴
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,20 +28,20 @@
|
|
28
28
|
export default class index extends Vue {
|
29
29
|
@Prop() public content!: string; ////public content: string = '';もやってみた
|
30
30
|
|
31
|
-
@Prop() public editForm!: string;
|
31
|
+
@Prop() public editForm!: string;
|
32
32
|
|
33
33
|
public insert(): void {
|
34
|
-
this.$store.commit('
|
34
|
+
this.$store.commit('insert', { content: this.content });//ここで受け取りたい
|
35
35
|
//値を空にする
|
36
36
|
this.content = '';
|
37
37
|
}
|
38
38
|
|
39
39
|
public remove(todo: any): void {
|
40
|
-
return this.$store.commit('
|
40
|
+
return this.$store.commit('remove', todo);
|
41
41
|
}
|
42
42
|
|
43
43
|
public edit(index: any): void {
|
44
|
-
this.$store.commit('
|
44
|
+
this.$store.commit('edit', { editForm: this.editForm, index });
|
45
45
|
this.editForm = '';
|
46
46
|
}
|
47
47
|
}
|
@@ -49,8 +49,9 @@
|
|
49
49
|
|
50
50
|
```
|
51
51
|
|
52
|
-
v-modelを取得しようとすると`Cannot read property '$store' of null`といったエラーが発生してしまいます。
|
52
|
+
`v-model="content"`を取得しようとすると`Cannot read property '$store' of null`といったエラーが発生してしまいます。
|
53
53
|
Typescriptを使って書きたいと思っているのですが、うまく行きません。
|
54
|
+
`v-model="content"`のみ上手くいかず、`v-model="editForm"`は正常に動きます。
|
54
55
|
|
55
56
|
・やってみたこと
|
56
57
|
0. get,setを使う
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,9 +26,9 @@
|
|
26
26
|
<script lang="ts">
|
27
27
|
import { Component, Emit, Prop, Vue, Watch } from 'nuxt-property-decorator';
|
28
28
|
export default class index extends Vue {
|
29
|
-
@Prop() public content!: string;
|
29
|
+
@Prop() public content!: string; ////public content: string = '';もやってみた
|
30
30
|
|
31
|
-
@Prop() public editForm!: string;
|
31
|
+
@Prop() public editForm!: string;//public editForm: string = '';もやってみた
|
32
32
|
|
33
33
|
public insert(): void {
|
34
34
|
this.$store.commit('todo/insert', { content: this.content });//ここで受け取りたい
|
@@ -50,11 +50,11 @@
|
|
50
50
|
```
|
51
51
|
|
52
52
|
v-modelを取得しようとすると`Cannot read property '$store' of null`といったエラーが発生してしまいます。
|
53
|
-
|
53
|
+
Typescriptを使って書きたいと思っているのですが、うまく行きません。
|
54
54
|
|
55
55
|
・やってみたこと
|
56
56
|
0. get,setを使う
|
57
|
-
0. 下記の書き方だと正常にv-modelの取得はできるが今回は
|
57
|
+
0. 下記のjsの書き方だと正常にv-modelの取得はできるが今回はTypescriptを使ったやり方をしたい
|
58
58
|
|
59
59
|
```Nuxt
|
60
60
|
export default {
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
<script lang="ts">
|
27
|
-
|
27
|
+
import { Component, Emit, Prop, Vue, Watch } from 'nuxt-property-decorator';
|
28
28
|
export default class index extends Vue {
|
29
29
|
@Prop() public content!: string;
|
30
30
|
|