screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <!-- Load Vuetify Icon and Styles --> <link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.9.55/css/materialdesignicons.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vuetify@3.1.11/dist/vuetify.min.css"> </head> <body> <div id="app"> <!-- Create Vuetify App --> <v-app> <v-main> <v-container> <h3>Vuetify Reset Form Fields</h3> <v-form ref="myForm"> <v-text-field v-model="name" :rules="[rules.required]" label="Name"></v-text-field> <v-text-field v-model="email" :rules="[rules.required, rules.email]" label="Email"></v-text-field> <v-btn color="primary" @click="resetForm">Reset</v-btn> </v-form> </v-container> </v-main> </v-app> </div> <!-- Load Vue.js and Vuetify script --> <script src="https://unpkg.com/vue@3.2.21/dist/vue.global.js"></script> <script src="https://cdn.jsdelivr.net/npm/vuetify@3.1.11/dist/vuetify.min.js"></script> <!-- Create Vue.js and Vuetify app --> <script type="module"> const { createApp } = Vue const { createVuetify } = Vuetify const vuetify = createVuetify() const app = createApp({ data() { return { name: '', email: '', rules: { required: (value) => !!value || 'Required.', email: (value) => /.+@.+\..+/.test(value) || 'Invalid email address.', }, }; }, methods: { resetForm() { this.$refs.myForm.reset() this.$refs.myForm.resetValidation() } }, }).use(vuetify).mount('#app'); // Mount the app to the #app element </script> </body> </html>