You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
668 B
JavaScript

const app = getApp();
Page({
data: {
url: ''
},
inputUrl(e) {
this.setData({
url: e.detail.value,
})
},
goScanCode() {
wx.scanCode({
onlyFromCamera: true,
success: ({result = ''}) => {
if(!result) {
wx.showToast({
title: '扫码失败',
icon: 'error'
})
}
this.setData({
url: result
}, this.goUrl)
}
})
},
goUrl() {
const url = this.data.url
wx.navigateTo({
url: '/pagesFace/pages/webview/webview?url=' + encodeURIComponent(url),
})
},
clearUrl() {
this.setData({
url: '',
})
}
})