vue写的域名提取器
标签搜索
侧边栏壁纸
  • 累计撰写 16 篇文章
  • 累计收到 24 条评论
vue

vue写的域名提取器

lay
lay
2022-09-21 / 5 评论 / 137 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年05月18日,已超过959天没有更新,若内容或图片失效,请留言反馈。

vue写的域名提取器

域名提取

主要的javascript代码

new Vue({
       el: '#app',
       data() {
           return {
               form: {
                   desc: '',
                   descdom: ''
               }
           }
       },
       methods: {
           onSubmit() {
               var array = this.form.desc.split('\n')
               var consequence = []
               for (let index = 0; index < array.length; index++) {
                   // console.log(array[index]);
               //   console.log(this.extract(array[index]));
                   // count(array[index],'.')
                  consequence.push(this.extract(array[index]))
               }
               // console.log(consequence.toString('\n'));
               this.form.descdom = consequence.join('\n')
           },


           extract(price) {
               var dot = price.indexOf(".")
               var newStr = price.substring(dot + 1)
               var record =  this.count(price, '.')
               if (record === 1) {
                   // console.log(price);
                   return (price)
               }
               // console.log(newStr)
               return (newStr)
           },

           count(str, value) {
               let b = str.indexOf(value);
               var num = 0;
               while (b !== -1) {
                   //   console.log("位置:" + b);
                   num++;
                   b = str.indexOf(value, b + 1)
               }
               return (num);
           },
       }
   })

1

评论 (5)

取消
  1. 头像
    wqoxwbpfyk
    Windows 10 · Google Chrome

    建议引入反面案例,增强辩证性。

    回复
  2. 头像
    rwbaemdbyn
    Windows 10 · Google Chrome

    建议增加个人经历分享,增强情感穿透力。

    回复
  3. 头像
    xkaqoeclaq
    Windows 10 · Google Chrome

    文字流畅如丝,语言优美动人,读来令人心旷神怡。

    回复
  4. 头像
    aeqhaabwtz
    Windows 10 · Google Chrome

    字里行间流露出真挚的情感,让人感同身受,共鸣不已。

    回复
  5. 头像
    uegskocoqt
    Windows 10 · Google Chrome

    这篇文章不错!

    回复