【发布时间】:2021-08-17 14:51:19
【问题描述】:
我有一个我正在编写的快速应用程序,其中包含一个快速应用程序页面,该页面通过 router.push API 仅引用单个自定义元素,无法触发该页面的 onShow 生命周期函数。
<import name="listone" src="./aa.ux"></import>
<template>
<!-- The template can contain only one root node. -->
<listone></listone>
</template>
<script>
import prompt from '@system.prompt'
export default {
private: {
},
onInit: function() {
},
onShow() {
console.log('Enter a string whatever you like.');
prompt.showToast({
message: 'Enter a string whatever you like.'
})
}, // This function cannot be triggered.
}
</script>
<style>
.demo-page {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
text-align: center;
}
</style>
还有我的 aa.ux 文件
<template>
<div class="container">
<text> Enter some words.</text>
<text>Enter some words.</text>
<text>Enter some words.</text>
<text>Enter some words.</text>
</div>
</template>
<style>
.container {
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #00fa9a;
}
</style>
<script>
module.exports = {
data: {
},
onInit() {
},
}
</script>
在这种情况下如何让 onShow 函数触发?
【问题讨论】:
标签: javascript android huawei-mobile-services huawei-developers