123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import {
- BrowseRecordAdd
- } from '@/api/applist.js'
- //防抖函数
- export function debounce(func, fnThis, wait) {
- var timer;
- return () => {
- timer && clearTimeout(timer);
- timer = setTimeout(() => {
- func.call(fnThis)
- timer = null
- }, wait);
- };
- }
- //节流函数
- export function debounce1(func, fnThis, wait) {
- var timer;
- return () => {
- clearTimeout(timer);
- timer = setTimeout(func.bind(fnThis), wait);
- };
- }
- let goMiniAppFlag = false
- //跳转小程序
- export function goMiniApp(data, item) {
- if (goMiniAppFlag) return
- goMiniAppFlag = true
- wx.navigateToMiniProgram({
- ...data,
- success: (res) => {
- // 打开成功
- goMiniAppFlag = false
- item && BrowseRecordAdd(item.id)
- },
- fail: () => {
- goMiniAppFlag = false
- }
- })
- }
- //跳转页面
- export function goPage(url) {
- uni.navigateTo({
- url
- });
- }
|