Vue的各种keyup键盘点击事件

Vue的各种keyup键盘点击事件


<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Documenttitle>
head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js">script>

<body>

    head>

    <body>
        <div id="app">
            
            <input type="text" @keyup.enter="fn">按键盘enter键触发<br>
            <input type="text" @keyup.13="fn">按键盘enter键触发<br>

            
            <input type="text" @keyup.delete="fn">按键盘"删除"和"退格"键触发<br>

            
            <input type="text" @keyup.tab="fn">按键盘tab键触发<br>

            
            <input type="text" @keyup.esc="fn">按键盘 esc 键触发<br>

            
            <input type="text" @keyup.space="fn">按键盘 space 键触发<br>

            
            <input type="text" @keyup.up="fn">按键盘 up 键触发<br>
            <input type="text" @keyup.down="fn">按键盘 down 键触发<br>
            <input type="text" @keyup.left="fn">按键盘 left 键触发<br>
            <input type="text" @keyup.right="fn">按键盘 right 键触发<br>


            
            <button @click.ctrl="fn">按ctrl键并点击触发button>
            
            <button @click.ctrl.exact="fn">按ctrl键并点击触发button>
        div>

        <script>
            let vm = new Vue({
                el: "#app",
                methods: {
                    fn() {
                        console.log(1111)
                    }
                }
            })
        script>

    body>

html>

你可能感兴趣的:(笔记)