今、Rails + Vue.jsで入力した文字数をカウントしてくれるフォームを作成しているのですが、validationに引っかかった時でも値を保持していられるような方法を探しており、もしご存知の方がいらっしゃいましたら教えていただきたいです。
microposts#new
#micropost = f.label :title, 'タイトル' 残り {{ Count }} 文字 = f.text_field :title, 'v-model' => 'typedText'
micropost.js
new Vue({ el: '#micropost', data: { typedText: '', }, computed: { Count: function() { return this.typedText.length; }, }, })
あなたの回答
tips
プレビュー