[Vuejs]-How can I make an input allowing only certain Names?

0👍

use a validation rule. Here is an example to get you started

https://codepen.io/radvic/pen/XWYxKpQ

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data: () => ({
    rules: [
      v => {
        for(index in v){
          const fileName = v[index].name;
           if(fileName.match(/george(.*)\.xlsx/g) === null){   
             return 'The file name "'+fileName+'" is wrong';
           }
        }
        return true;          
      },
    ],
  }),
})
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.0.18/dist/vuetify.min.js"></script>
<div id="app">
  <v-app id="inspire">
    <v-file-input multiple :rules="rules" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"></v-file-input>
  </v-app>
</div>

Leave a comment