34 lines
899 B
TypeScript
34 lines
899 B
TypeScript
import { UNRELEASED_PAGE_ENTRIES } from './unreleasedDebug.config';
|
|
|
|
Page({
|
|
data: {
|
|
entries: UNRELEASED_PAGE_ENTRIES,
|
|
isDevEnv: true,
|
|
},
|
|
|
|
onLoad() {
|
|
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion;
|
|
const isDevEnv = envVersion === 'develop';
|
|
this.setData({ isDevEnv });
|
|
|
|
if (!isDevEnv) {
|
|
wx.showToast({ title: '仅开发版可用', icon: 'none' });
|
|
}
|
|
},
|
|
|
|
onTapEntry(e: WechatMiniprogram.TouchEvent) {
|
|
if (!this.data.isDevEnv) return;
|
|
let path = e.currentTarget.dataset.path as string;
|
|
if (!path) return;
|
|
if (!path.startsWith('/')) {
|
|
path = `/${path}`;
|
|
}
|
|
wx.navigateTo({
|
|
url: path,
|
|
fail: () => {
|
|
wx.showToast({ title: '页面跳转失败', icon: 'none' });
|
|
},
|
|
});
|
|
},
|
|
});
|