質問編集履歴

2

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

2019/08/15 07:51

投稿

utoc11
utoc11

スコア15

test CHANGED
File without changes
test CHANGED
@@ -142,6 +142,10 @@
142
142
 
143
143
  <script>
144
144
 
145
+
146
+
147
+ methods: {
148
+
145
149
   //これがダメ
146
150
 
147
151
   cursorNow() {
@@ -170,6 +174,8 @@
170
174
 
171
175
  },
172
176
 
177
+ }
178
+
173
179
  </script>
174
180
 
175
181
  ```

1

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

2019/08/15 07:51

投稿

utoc11
utoc11

スコア15

test CHANGED
File without changes
test CHANGED
@@ -123,3 +123,53 @@
123
123
  Nuxt.js
124
124
 
125
125
  Vuetify
126
+
127
+
128
+
129
+ ###追加情報(2019/8/14 23時頃追記)
130
+
131
+
132
+
133
+ どうやら、setSelectionRangeがそもそもうまくいかないようです。
134
+
135
+
136
+
137
+ ```Vue
138
+
139
+ v-btn(@click="cursorNow") テスト
140
+
141
+
142
+
143
+ <script>
144
+
145
+  //これがダメ
146
+
147
+  cursorNow() {
148
+
149
+ this.$refs.r.focus();
150
+
151
+ console.log('カーソルなう')
152
+
153
+ this.$refs.r.setSelectionRange(0,9999);
154
+
155
+ },
156
+
157
+
158
+
159
+  //これでもダメ
160
+
161
+  cursorNow() {
162
+
163
+ this.$refs.r.focus();
164
+
165
+ this.$nextTick(() => {
166
+
167
+ this.$refs.r.setSelectionRange(0,9999);
168
+
169
+ });
170
+
171
+ },
172
+
173
+ </script>
174
+
175
+ ```