Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecordApp.UniPageOnShow is not a function #247

Open
IlangshenI opened this issue Sep 19, 2024 · 1 comment
Open

RecordApp.UniPageOnShow is not a function #247

IlangshenI opened this issue Sep 19, 2024 · 1 comment

Comments

@IlangshenI
Copy link

import Recorder from 'recorder-core'
import '../../../../../uni_modules/Recorder-UniCore/app-uni-support.js'
// #ifdef MP-WEIXIN
import 'recorder-core/src/app-support/app-miniProgram-wx-support.js'
// #endif

import RecordApp from 'recorder-core/src/app-support/app.js'
// import { ref, getCurrentInstance, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app'
const isVue3=ref(true);
const recpowerx=ref(0);
const recpowert=ref("");
const reclogs=ref([]);
const isRunning = ref(false); // 控制计时器状态v
const currentTime = ref(0); // 存储当前时间(秒)
var vue3This=getCurrentInstance().proxy; //必须定义到最外面,getCurrentInstance得到的就是当前实例this
onMounted(()=>{
vue3This.isMounted=true;
RecordApp.UniPageOnShow(vue3This); //onShow可能比mounted先执行,页面准备好了时再执行一次
});
onUnmounted(()=>{
RecordApp.Stop(); //清理资源,如果打开了录音没有关闭,这里将会进行关闭
});
onShow(()=>{
if(vue3This.isMounted) RecordApp.UniPageOnShow(vue3This); //onShow可能比mounted先执行,页面可能还未准备好
});

最后报错RecordApp.UniPageOnShow is not a function
大佬们怎么解决呢

@xiangyuecn
Copy link
Owner

import RecordApp from 'recorder-core/src/app-support/app.js'
这句要放到 app-uni-support.js 前面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants