Small micro-channel program forty-six query or access an external web page (super-simple)

First on the map.
Here Insert Picture Description

  • The figure shows that it is a small program forty-six search function, but it never occurred to you to let you day and night trying to come up how to achieve this function as long as the word actually can be achieved! Let us look at how to achieve it:

  • In short, the use of web-view [] components to complete.

detailed:

js page

// pages/cetchaxun/cetchaxun.js
Page({



  /**
   * 页面的初始数据
   */
  data: {
    newsUrl:"https://www.chsi.com.cn/cet/"  //这里访问的是学信网的四六级查询链接

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})

wxml page

<!--pages/cetchaxun/cetchaxun.wxml-->
<web-view src="{{newsUrl}}"></web-view>

OK.

Published 13 original articles · won praise 8 · views 5570

Guess you like

Origin blog.csdn.net/weixin_43207103/article/details/104456353