Vue.js [Vue warn]:未能生成渲染函数:语法错误:中出现意外字符串

Vue.js [Vue warn]:未能生成渲染函数:语法错误:中出现意外字符串,vue.js,Vue.js,o通常,当我为keyup和keypress事件的输入标记及其相应的vue代码编写代码时,会出现此错误,但当我编写 keydown事件的下一个输入标记及其对应的vue代码我遇到了一个错误 像 直到两次输入之前,我已经运行了这段代码,所以我删除了我的新代码和它们对应的vue代码,然后我再次运行,但现在我仍然在正确的前一段代码中得到错误 //leckeyboadevent.html <!DOCTYPE html> <html lang="en"> <head>

o通常,当我为keyup和keypress事件的输入标记及其相应的vue代码编写代码时,会出现此错误,但当我编写
keydown事件的下一个输入标记及其对应的vue代码我遇到了一个错误 像

直到两次输入之前,我已经运行了这段代码,所以我删除了我的新代码和它们对应的vue代码,然后我再次运行,但现在我仍然在正确的前一段代码中得到错误

//leckeyboadevent.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://unpkg.com/vue@2.6.6/dist/vue.js"></script>
</head>
<body>
    <div id="myapp">
        <input type="text" placeholder="keypress"  @keypress="keypressfun" >
        <br\>

        <input type="text" placeholder="keyup" @keyup="keyupfun">
        <br\>

        <input type="text" placeholder="keydown" @keydown="keydownfun">

    </div>
    <script src="lec6keyboardevent.js"></script>
</body>
</html>

文件
//这是我的js文件

var myapp=new Vue({
    el:"#myapp",
    data:{

    },
    methods:{
        keypressfun:function(event){
            console.log(event.key);
        },
        keyupfun:function(event)//this works when key release
        {
            console.log(event);
        },
        keydownfun:function()
        {
            console.log("keydown");
        }
    }
});

i am getting error 
vue.js:634 [Vue warn]: Failed to generate render function:

SyntaxError: Unexpected string in

with(this){return _c('div',{attrs:{"id":"myapp"}},[_c('input',{attrs:{"type":"text","placeholder":"keypress"},on:{"keypress":keypressfun}}),_v(" "),_c('br',{attrs:{"\":""}}),_v(" "),_c('input',{attrs:{"type":"text","placeholder":"keyup"},on:{"keyup":keyupfun}}),_v(" "),_c('br',{attrs:{"\":""}}),_v(" "),_c('input',{attrs:{"type":"text","placeholder":"keydown"},on:{"keydown":keydownfun}}),_v(" "),_c('br'),_c('br')])}


(found in <Root>)
var myapp=new Vue({
el:#myapp“,
数据:{
},
方法:{
按键乐趣:功能(事件){
console.log(event.key);
},
keyupfun:function(event)//当释放键时,此选项起作用
{
console.log(事件);
},
keydownfun:function()
{
控制台日志(“键控”);
}
}
});
我犯了一个错误
vue.js:634[vue warn]:无法生成渲染函数:
SyntaxError:中出现意外字符串
与(本)和(本)有关的(本)层返回(返回)返回(返回)c(返回)和(返回)与(返回)返回(返回)c(返回)和(本)和(返回)返回(返回)c(返回)c((('div)的('div,,{attrs:{id:“id:“id:“id:“myapp”myapp“},,,[[U c('输入',{attrs:,{”输入',,{attrs:{”类型:““文本”输入”文本”,“占位旋“““;键键压“““,”键压“,”键压“,”键压”键键压“}”,上,上,上,上,上,上,上,上,上,上,上,上,上,上,上,(返回(返回返回返回(返回)c('返回(返回)c((('返回)c('返回)c(((((((((c('input',{attrs:{“type”:“text”,“placeholder”:“keydown”},on:{“keydown”:keydownfun}),_v(“”,_c('br'),_c('br'))}
(位于)

Hi@user9083922我认为问题在于如何关闭html标记。 您是否尝试过以标准方式关闭br标记,而不是以标准方式关闭

它应该适应这种变化

此外,如果您愿意,

标记在html5中不需要关闭,因为它们是无效元素

有关更多信息,您可以查看:

这确实是Vue感到不安的原因,它试图生成一个方法以Vue的方式呈现事物,但是格式错误的br标记中的\逃逸了结束引号,导致了问题