Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <template>
  <div id="signup">
    <div id="signin">
     <div class="form">
           <form class="login-form" @submit.prevent="onSubmit">
            <div class="input" :class="{invalid: $v.email.$error}">
          <h6 v-if="!$v.email.email">Please provide a valid email address.</h6>
          <h6 v-if="!$v.email.unique">This email address has been taken.</h6>
          <input
                  type="email"
                  placeholder="Email"
                  id="email"
                  @blur="$v.email.$touch()"
                  v-model="email">
        <!-- <p>{{$v}}</p> -->
        
        </div>
         <div class="input">
          <input
                  type="name"
                  placeholder="name"
                  id="name"
                  v-model="name">
        <!-- <p>{{$v}}</p> -->
        
        </div>
        <div class="input" :class="{invalid: $v.age.$error}">
          <h6 v-if="!$v.age.minVal">You have to be at least {{ $v.age.$params.minVal.min }} years old.</h6>
          <input
                  type="number"
                  id="age"
                  placeholder="Age"
                  @blur="$v.age.$touch()"
                  v-model.number="age">
          
        </div>
        <div class="input" :class="{invalid: $v.password.$error}">
          <input
                  type="password"
                  placeholder="Password"
                  id="password"
                  @blur="$v.password.$touch()"
                  v-model="password">
        </div>
        <div class="input" :class="{invalid: $v.confirmPassword.$error}">
          <input
                  type="password"
                  placeholder="Confirm Password"
                  id="confirm-password"
                  @blur="$v.confirmPassword.$touch()"
                  v-model="confirmPassword">
        </div>
          <button type="submit" :disabled="$v.$invalid">create</button>
          <p class="message">Already registered? <router-link to="/signin">Sign In</router-link></p>
        </form> 
  </div>
  </div>
  </div>
</template>

<script>

import { required, email, numeric, minValue, minLength, sameAs } from 'vuelidate/lib/validators'
  import axios from 'axios'
export default {
    data () {
      return {
        email: '',
        name: '',
        age: null,
        password: '',
        confirmPassword: ''
      }
    },
     methods : {
       onSubmit () {
        const signupData = {
          name:this.name,
          email: this.email,
          age: this.age,
          password: this.password,
          confirmPassword : this.confimPassword
        }
        console.log(signupData)
        this.$store.dispatch('signup', signupData)
      }
     },
     validations: {
      email: {
        required,
        email,
        unique: val => {
          if (val === '') return true
          return axios.get('https://vue-journal.firebaseio.com/users.json?orderBy="email"&equalTo="' + val + '"')
            .then(res => {
              return Object.keys(res.data).length === 0
            })
        }
      },
      age: {
        required,
        numeric,
        minVal: minValue(18)
      },
      password: {
        required,
        minLen: minLength(6)
      },
      confirmPassword: {
//        sameAs: sameAs('password')
        sameAs: sameAs(vm => {
          return vm.password
        })
      }
    }
}
</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                

              
            
!
999px

Console