var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, textInput:'' } }, mounted() { var that = this; }, methods: { sendMessage() { let sendData = { keyType: 'print', keyVal: '123', } console.log('sendMessage 开始1:') console.log('sendMessage 开始2:' + JSON.stringify(sendData)) uni.webView.postMessage({ data: JSON.stringify(sendData) }) }, sendScan() { var that = this; that.$toast.fail("暂时不能使用!"); } } })