<script setup>
import {onMounted} from 'vue'
import {amisRender} from '../utils.js'

const toastMessage = () => {
  alert('click in vue')
}

onMounted(() => {
  amisRender(
      '#amis-home',
      information => {
        return {
          type: 'page',
          body: [
            "Home",
            {
              type: 'action',
              label: '点击',
              onEvent: {
                click: {
                  actions: [
                    {
                      actionType: 'custom',
                      script: (context, doAction, event) => {
                        toastMessage()
                      }
                    }
                  ]
                }
              }
            }
          ]
        }
      },
  )
})
</script>

<template>
  <div id="amis-home"></div>
</template>

<style scoped>
</style>