All Products
Search
Document Center

Mobile Platform as a Service:Event binding

Last Updated:Jul 28, 2026

This article introduces the types of events that can be bound to Ant Dynamic Cards and the methods for binding them.

Common events

Within a card, the following two types of events can be bound to the template:

  • Click

  • Longpress

Template usage

Following the Vue format, event binding in template mode only supports directives. Directives support abbreviated formats. When using them, the event name that can be bound (i.e., @click in the example code below) is determined by the component the card is registered with. For more information about the components that can be registered with the card, please see div.

  • The bound handler function parameter (i.e., param in the example code below) supports expressions.

  • The corresponding business JS methods can be defined in the <script> section, and there are no restrictions on the parameters of the methods.

<template>
...
        <text @click="click(param)"></text>
...
</template>

<script>
    export default {
        data: {
        },
        beforeCreate() {
        },
        methods: {
            click(p) {
                console.info("onclick");                
            }
        }
    }
</script>

Example code

Download detailBindEvent.zip for the complete sample code.