美文网首页
js居然老是报错Uncaught SyntaxError: In

js居然老是报错Uncaught SyntaxError: In

作者: 江江简书 | 来源:发表于2020-04-16 22:41 被阅读0次

    这个错误很普遍,但是也是很不察觉

    错误的写法

    let mytext = data;

    • return <a onmouseover=showtext(${mytext},this)>${data.slice(0,10)} ...</a>;

    正确的写法

    let mytext = ''' + data + ''';

    • return <a href="return false" onmouseover="showtext(${mytext},this)">${data.slice(0,10)} ...</a>;

    总结:其实就是标签的元素 没有用引号包裹导致的

    相关文章

      网友评论

          本文标题:js居然老是报错Uncaught SyntaxError: In

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