Toast模块 #
此模块调用显示android
系统Toast
。
基础用法
点击查看源码
<template>
<div class="es-sdk-root-css">
<s-title-view class="es-sdk-content-title-css" :text="$options.name" />
<div class="es-sdk-content-divider-css" />
<div class="es-sdk-content-row-css">
<s-text-button text="点击显示Toast" @onButtonClicked="showToast" />
<s-text-button
text="点击显示ShortToast"
@onButtonClicked="showShortToast"
/>
<s-text-button
text="点击显示LongToast"
@onButtonClicked="showLongToast"
/>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from '@vue/runtime-core'
import { useESToast } from '@extscreen/es3-core'
export default defineComponent({
name: 'Toast模块',
setup() {
const toast = useESToast()
function showToast() {
toast.showToast('这是一个Toast')
}
function showLongToast() {
toast.showLongToast('这是一个LongToast')
}
function showShortToast() {
toast.showShortToast('这是一个ShortToast')
}
return {
showToast,
showLongToast,
showShortToast,
}
},
})
</script>
<style></style>
qt.toast 用法 alpha
点击查看源码
<template>
<div class="es-sdk-root-css">
<s-title-view class="es-sdk-content-title-css" :text="$options.name" />
<div class="es-sdk-content-divider-css" />
<div class="es-sdk-content-row-css">
<s-text-button text="点击显示Toast" @onButtonClicked="showToast" />
<s-text-button
text="点击显示ShortToast"
@onButtonClicked="showShortToast"
/>
<s-text-button
text="点击显示LongToast"
@onButtonClicked="showLongToast"
/>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from '@vue/runtime-core'
export default defineComponent({
name: 'Toast模块',
setup() {
function showToast() {
qt.toast.showToast('这是一个Toast')
}
function showLongToast() {
qt.toast.showLongToast('这是一个LongToast')
}
function showShortToast() {
qt.toast.showShortToast('这是一个ShortToast')
}
return {
showToast,
showLongToast,
showShortToast,
}
},
})
</script>
<style></style>
API #
Exposes #
Name | Description | Type |
---|---|---|
showToast | 该方法显示吐司 | Function |
showLongToast | 该方法显示长时间吐司 | Function |
showShortToast | 该方法显示短时间吐司 | Function |