Step 1: Add a new page
pages
Create a new file under the file in the applet directory , and name it asnews
app.json
Add a new page in"pages/news/news"
At this time, news
four configuration files appear under the folder.
Step 2: Jump to the page
Method 1: Navigator is added
on the home page of the applet, index.wxml
namely<navigator url="../news/news">跳转至新页面</navigator>
The effect is as shown in the figure above, click on this text segment to jump to a new page.
Method 2: button
On the home page of the applet, that is index.wxml
, add <button bindtap="aaa" size="mini" type="primary">跳转至新页面</button>
, which aaa
is a newly defined function size
to control the size of the button.
Define a function in index.js
, jump to a new page.
aaa(){
wx.navigateTo({
url: '../news/news',
})
},
The effect is as shown in the figure, and clicking the button will jump to a new page.