|
[App引擎]
弹出隐私政策提示框后打开新窗口页面无法监听返回键
[复制链接]
本帖最后由 imo. 于 2022-8-9 17:40 编辑
弹出隐私政策提示框后打开新窗口页面无法监听返回键
首先在widget/pages/privacy/privacy.stml页面,然后点击隐私URL,打开openwin一个页面(不打算采用打开浏览器的方式,体验不太好)
该页面demo
- <template>
- <view class="main">
- <view class="safe-area">
- <safe-area></safe-area>
- <view class="header">
- <view class="back" @click="closeWin">
- <image class="backicon" src="../../image/daishu_tt_lefterbackicon_titlebar.png" />
- </view>
- <text class="title">{{title}}</text>
- </view>
- </view>
- <frame v-if="url" class="main" name="openurl" :url="url"></frame>
- </view>
- </template>
- <style>
- .main {
- width: 100%;
- height: 100%;
- background: #f3f3f3;
- }
- .safe-area {
- background-color: #f8f8f8;
- }
- .header {
- height: 50px;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- border-bottom: 0.5px solid #ddd;
- position: relative;
- }
- .back {
- position: absolute;
- display: flex;
- align-content: center;
- align-items: center;
- justify-content: center;
- flex-direction: row;
- width: 50px;
- height: 40px;
- top: 0px;
- left: 10px;
- }
- .backicon {
- width: 20px;
- height: 20px;
- }
- .title {
- font-weight: bold;
- font-size: 16px;
- width: 200px;
- text-align: center;
- color: #000;
- }
- .text {
- margin: 8px;
- }
- .main {
- width: 100%;
- height: 100%;
- }
- </style>
- <script>
- export default {
- name: 'openurl_win',
- data() {
- return {
- url: "",
- title: ""
- }
- },
- methods: {
- closeWin() {
- api.closeWin();
- }
- },
- apiready() {
- var that = this;
- api.addEventListener({
- name: 'keyback'
- }, function (ret, err) {
- api.closeWin();
- });
- if (api.pageParam.url) {
- that.data.url = api.pageParam.url;
- }
- api.setFrameClient({
- frameName: 'openurl'
- }, function (ret, err) {
- if (ret.title) {
- that.data.title = ret.title;
- }
- });
- }
- }
- </script>
复制代码
keyback这段不能被监听,无法通过返回键关闭这个页面
|
|