荣兄面试精华

荣兄面试精华

// An highlighted block
var foo = 'bar';
<template>
  <div class="rotate_contanier">
    <div>
      <label>份数</label>
      <input type="text" v-model="fenshu" />
    </div>
    <div>
      <label>描述</label>
      <textarea v-model="miaoshu"></textarea>
    </div>
    <div>
      <label>天数</label>
      <input type="text" v-model="tianshu" />
    </div>
    <button @click="save">保存</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      fenshu: '',
      miaoshu: '',
      tianshu: ''
    }
  },
  methods: {
    save () {
      const reg = /^\d+$|^\d+[.]?\d+$/
      this.miaoshu = this.miaoshu.replace(/bug|bad/g, '**')
      if (this.fenshu.length === 0) {
        alert('份数为必填!')
      } else if (this.fenshu.length < 10 || this.fenshu.length > 20) {
        alert('份数不能小于10或者大于20!')
      } else if (this.miaoshu.length === 0) {
        alert('描述为必填!')
      } else if (!reg.test(this.tianshu)) {
        alert('只能输入数字!')
      } else {
        alert('保存成功!')
      }
    }
  }
}
</script>

<style>
</style>

上一篇:redis学习笔记


下一篇:SQL经典面试题及答案