# wx.navigateTo(Object object)

with Promise style call: Supported

Need page permissions: Mini Programs cannot call this interface from a plugin page, and plugins cannot call the interface from the plugins page

Mini Program plugin: Support, need to Mini Program base library version no less than 2.2.2

When used in Mini Programs plug-ins, can only be called from the page of the current plug-in

WeChat Windows edition:: Support

WeChat Mac edition:: Support

Keep the current page and jump to a page within your application. But you can't jump Tabs Page. use wx.navigateBack You can go back to the original page. The page stack in the Mini Program has up to ten layers.

# parameter

# Object object

attribute type Default values Required Introductions
url string yes Need to jump within the application tabBar Path to the page of (Code packet path), Path can be followed with parameters. Between parameters and paths `` Delimits parameter keys with parameter values = Connected, with different parameters & SeparateSuch as 'pathkey=value&key2=value2'
events Object no Interpage communication interface, used to listen to open pages sent to the current page data. Base library 2.7.3 Start supporting.
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.success callback

# parameter
# Object res
attribute type Introductions
eventChannel EventChannel To communicate with the opened page

# sample code

wx.navigateTo({
  url: 'testid=1',
  events: {
    // Adds a listener for the specified event to get the data sent to the current page by the open page
    acceptDataFromOpenedPage: function(data) {
      console.log(data)
    },
    someEvent: function(data) {
      console.log(data)
    }
    ...
  },
  success: function(res) {
    // Transfer data to the open page via the event channel
    res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
  }
})
//test.js
Page({
  onLoad: function(option){
    console.log(option.query)
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.emit('acceptDataFromOpenedPage', {data: 'test'})
    eventChannel.emit('someEvent', {data: 'test'})
    // Listen for the acceptDataFromOpenerPage event to get the data from the previous page passed through the eventChannel to the current page
    eventChannel.on('acceptDataFromOpenerPage', function(data) {
      console.log(data)
    })
  }
})