Files
Neo-ZQYY/apps/miniprogram - 副本/miniprogram/components/dev-fab/dev-fab.ts

29 lines
641 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 开发调试浮动按钮组件
*
* 仅在 develop 环境下显示,点击跳转到 dev-tools 页面。
* 使用 movable-view 实现可拖拽。
*/
Component({
data: {
visible: false,
x: 580, // 初始位置右下角附近rpx 换算后的 px 近似值)
y: 1100,
},
lifetimes: {
attached() {
// 仅 develop 环境显示
const accountInfo = wx.getAccountInfoSync()
const env = accountInfo.miniProgram.envVersion
this.setData({ visible: env === "develop" })
},
},
methods: {
goDevTools() {
wx.navigateTo({ url: "/pages/dev-tools/dev-tools" })
},
},
})