this click is invalid, whether or not to add the native modifier, or whether to add parentheses after test.
this p tag can be clicked, and there are no syntax errors in the code.
the code is as follows:
<template>
<div class="add_wrap">
<form id="add_contact">
<div class="avatar_area">
<input type="file" name="avatar" hidden>
</div>
<div class="input_list">
<span class="left"></span>
<input type="text" name="name">
<span class="left"></span>
<input type="text" name="mobile">
<span class="left"></span>
<input type="text" name="telephone">
<span class="left"></span>
<input type="text" name="email">
<span class="left"></span>
<input type="text" name="company">
<span class="left"></span>
<input type="text" name="title">
<span class="left"></span>
<input type="text" name="fax">
</div>
</form>
<p class="add_my_field">
<p @click.native="test">
</div>
</template>
<script>
import global_ from "@/components/Global";
export default {
name: "app-add",
data() {
return {
thisId: undefined,
preField: global_.preField
};
},
methods: {
test() {
console.log(111);
let form = document.querySelector("-sharpadd_contact");
let now_data = new FormData(form);
console.log(now_data);
}
}
};
</script>
refers to a component Global, that holds global constants but does not actually use it. The data in data is also not used. No error was reported when compiling and running with vue-cli,.