The function 'handleQueryNewsId' is used to handle the query for a specific news ID.

  1. The 'loading' variable is set to 'true' to indicate that the query is in progress.
  2. The 'thisNewsId' variable is assigned the value of 'formData.newsId', which is the inputted news ID.
  3. The 'getNewsPage' function is called with the parameters 'newsId: thisNewsId', 'page: 1', and 'pageSize: 10' to retrieve the news page with the specified news ID.
  4. The retrieved data is logged to the console.
  5. The 'newsIds' variable is assigned an array of news IDs extracted from the retrieved data.
  6. If the 'newsIds' array includes the 'thisNewsId', it means that the news ID exists. In this case, a message is logged to indicate that the news ID is on sale.
  7. If the 'newsIds' array does not include the 'thisNewsId', it means that the news ID does not exist. In this case, a message is logged to indicate that the news ID does not exist.
  8. The 'newsList' variable is assigned the value of 'data.rows', which contains the retrieved news data.
  9. The 'total' variable is assigned the value of 'data.total', which represents the total number of news pages.
  10. Finally, the 'loading' variable is set to 'false' to indicate that the query is complete.

原文地址: https://www.cveoy.top/t/topic/ht6U 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录