It's just like the title,
I am trying to input a reasonably large number of characters and non-breakable data into the textarea and send it with the enter key (keydown or keyup).
The textarea was used because it cannot be wrapped with input (isn't it?).

However, in this way, in response to enterkey, a line break will be entered in the textarea, and a line break display will appear on the screen. I am in trouble because it is a very crafty situation.

I want to enter with no modifier keys instead of ctrl + etner etc.
Is there any good way?

Thank you.

We use vue.

  • Answer # 1

        <textarea @ keydown.enter.prevent = "handleSubmit"></textarea>
    export default {
      name: "HelloWorld",
      data () {
        return {
          msg: "Welcome to Your Vue.js App"
      methods: {
        handleSubmit () {
          console.log ('submit!')
    If you add the

    preventmodifier, a line break will not occur whenenteris pressed.

Related articles