警报不适用于 vuejs
Alert will not work with vuejs
我正在关注 https://laracasts.com/series/learning-vue-step-by-step/episodes/3。我正在使用 netbeans 8.1。当我按下提交按钮时,vue 对象中的警报不会发生,而是发生 done.html 的默认 html 操作。控制台中唯一的错误是:
GET http://localhost:8383/favicon.ico net::ERR_EMPTY_RESPONSE
我的代码就在网络广播中:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
auth0.com/blog/2015/11/13/build-an-app-with-vuejs/
-->
<!--<html>-->
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="">
</head>
<body>
<div id="app">
<form action="done.html">
<button type="submit" v-on:submit="handleIt">
<!--<button>-->
submit me!!
</button>
<pre> {{$data|json}}</pre>
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script>
<script>
// var data = {message: "hi there"}
new Vue({
el: '#app',
methods: {
handleIt: function()
{alert('hgjfhgjf');}
}
});
</script>
</body>
</html>
我做错了什么?
我不是vuejs
专家,但是,据我所知,你必须把v-on:submit
放在表单元素上,像这样<form action="done.html" v-on:submit="handleIt">
我忘了在 HTML 文件中添加 vue_instance 文件。
我正在关注 https://laracasts.com/series/learning-vue-step-by-step/episodes/3。我正在使用 netbeans 8.1。当我按下提交按钮时,vue 对象中的警报不会发生,而是发生 done.html 的默认 html 操作。控制台中唯一的错误是:
GET http://localhost:8383/favicon.ico net::ERR_EMPTY_RESPONSE
我的代码就在网络广播中:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
auth0.com/blog/2015/11/13/build-an-app-with-vuejs/
-->
<!--<html>-->
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="">
</head>
<body>
<div id="app">
<form action="done.html">
<button type="submit" v-on:submit="handleIt">
<!--<button>-->
submit me!!
</button>
<pre> {{$data|json}}</pre>
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script>
<script>
// var data = {message: "hi there"}
new Vue({
el: '#app',
methods: {
handleIt: function()
{alert('hgjfhgjf');}
}
});
</script>
</body>
</html>
我做错了什么?
我不是vuejs
专家,但是,据我所知,你必须把v-on:submit
放在表单元素上,像这样<form action="done.html" v-on:submit="handleIt">
我忘了在 HTML 文件中添加 vue_instance 文件。