美文网首页
2020-10-14

2020-10-14

作者: 一人创客 | 来源:发表于2020-10-14 15:21 被阅读0次
blur() {
  let _textarea2 = this.textarea2.replace(/\s*/g, "");
  // 去除空格
  // 构建函数字符串,供eval解析
  let fun_str = "(" + _textarea2 + ")";
  let result;
  try {
    result = eval(fun_str);
  } catch (err) {
    // 这里可以给用户一些提示,让输入数组或json格式,而不是其它类型的字符串
    console.log("错误了");
    console.log(err);
  }
  console.log(result);
  console.log(typeof result);
  this.dropCol = this.col = result;
},

相关文章

网友评论

      本文标题:2020-10-14

      本文链接:https://www.haomeiwen.com/subject/eblwpktx.html