WeChat applet's absolute path, relative path, return to a certain page and abandon.../../

**

1. Absolute path, relative path

**
The applet has been written for a long time and is still stuck in pictures.../.../The times are really out. . . Abandon…/…/ and just write /images and that’s it!

"./": represents the current path

".../": represents the path to the upper level

Starting with "/", code root directory (absolute path)

The absolute path can be used in login filtering to jump to the login page after the token expires.

**

2. Return to a certain page

**

/**
   * 关闭到某个页面
   */
  goback(pageRoute ) {
    
    
    let index
    getCurrentPages().find((pageItem, routeIndex) => {
    
    
      if (pageItem.route == pageRoute) index = routeIndex
    })
    console.log("回退的页面为:", pageRoute, index)
    wx.navigateBack({
    
    
      delta: getCurrentPages().length - index - 1,
    })
  },

Reference article:
WeChat applet - absolute path, relative path, return to a certain page: https://blog.csdn.net/wy313622821/article/details/119103856

Guess you like

Origin blog.csdn.net/ws19900201/article/details/124420595