質問するログイン新規登録

質問編集履歴

2

追加情報のところに、methodsで囲むのを忘れていたので追記しました。

2019/08/15 07:51

投稿

utoc11
utoc11

スコア15

title CHANGED
File without changes
body CHANGED
@@ -70,6 +70,8 @@
70
70
  v-btn(@click="cursorNow") テスト
71
71
 
72
72
  <script>
73
+
74
+ methods: {
73
75
   //これがダメ
74
76
   cursorNow() {
75
77
  this.$refs.r.focus();
@@ -84,5 +86,6 @@
84
86
  this.$refs.r.setSelectionRange(0,9999);
85
87
  });
86
88
  },
89
+ }
87
90
  </script>
88
91
  ```

1

setSelectionRangeがそもそもうまくいかないようなので、その旨を追記。

2019/08/15 07:51

投稿

utoc11
utoc11

スコア15

title CHANGED
File without changes
body CHANGED
@@ -60,4 +60,29 @@
60
60
  ### 補足情報(FW/ツールのバージョンなど)
61
61
 
62
62
  Nuxt.js
63
- Vuetify
63
+ Vuetify
64
+
65
+ ###追加情報(2019/8/14 23時頃追記)
66
+
67
+ どうやら、setSelectionRangeがそもそもうまくいかないようです。
68
+
69
+ ```Vue
70
+ v-btn(@click="cursorNow") テスト
71
+
72
+ <script>
73
+  //これがダメ
74
+  cursorNow() {
75
+ this.$refs.r.focus();
76
+ console.log('カーソルなう')
77
+ this.$refs.r.setSelectionRange(0,9999);
78
+ },
79
+
80
+  //これでもダメ
81
+  cursorNow() {
82
+ this.$refs.r.focus();
83
+ this.$nextTick(() => {
84
+ this.$refs.r.setSelectionRange(0,9999);
85
+ });
86
+ },
87
+ </script>
88
+ ```