<template> <view> <native-button class="native-button" style="width: 200px; height: 100px;" :text="buttonText" @tap="ontap" @load="onload"></native-button> </view> </template> <script> export default { data() { return { title: 'Hello', buttonText: "封装object实现的button", isLoad: false } }, onLoad() { }, methods: { ontap(e: UniObjectCustomEvent) { console.log("native-button----------"+e.type) }, onload() { //标记已初始化 用于自动化测试 this.isLoad = true } } } </script> <style> .native-button { height: 100px; width: 100px; margin: 100px auto 25px auto; } </style>