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);
},
}
})
建议引入反面案例,增强辩证性。
建议增加个人经历分享,增强情感穿透力。
文字流畅如丝,语言优美动人,读来令人心旷神怡。
字里行间流露出真挚的情感,让人感同身受,共鸣不已。
这篇文章不错!