0
Follow
0
View

Problems with uniapp secondary navigation rendering

imperial_mark 注册会员
2023-02-25 11:13

This answer quotes ChatGPT

If you want the page to display the obtained city and type of data at the beginning of the page instead of requiring the user to click manually to display it, you can manually call a computed property that filters data once at page initialization.

You can manually call the computed property in the page's created or mounted hook function to initiate rendering of data.

Example:



created() {
  this.rentData // 手动调用computed属性
}
或者

javascript
Copy code
mounted() {
  this.rentData // 手动调用computed属性
}

This way, when the page is initialized, the computed property is called immediately, sifting through the data and rendering the page.

If you want to update the page automatically after you get the city and type data, you can use watch to monitor the changes of the city and type and call the computed property manually after the changes.

Example:


watch: {
  theCity: function(newVal, oldVal) {
    this.rentData // 手动调用computed属性
  },
  navMain: function(newVal, oldVal) {
    this.rentData // 手动调用computed属性
  }
}

This way, when a city or type changes, watch is triggered and a computed property is called manually to rescreen the data and render the page.

About the Author

Question Info

Publish Time
2023-02-25 11:13
Update Time
2023-02-25 11:13

Related Question