UNPKG

minix-template

Version:

minix template

85 lines (83 loc) 1.67 kB
/* * @Description: * @Autor: tangsj * @Date: 2022-05-11 14:08:45 * @LastEditTime: 2022-05-23 16:42:35 */ import router from '@system.router' import prompt from '@system.prompt' export default { data: { weatherList:[ { name:'getWeatherInfo', // url:'pages/base/canlUse/index', describe:'获取指定城市的天气信息' }, { name:'getAppWeatherInfo', // url:'pages/base/log/index', describe:'获取天气信息' } ] }, goRouter(url){ router.push({ uri: url, }) }, /** * @description: 获取指定城市的天气信息 * @param {*} * @return {*} */ getWeatherInfo(){ const params = { cityNo: '深圳' } this.$app.$def.bridge.getWeatherInfo(params) .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, /** * @description: 获取天气信息 * @param {*} * @return {*} */ getAppWeatherInfo(){ const params = { isNeedRefresh: true, } this.$app.$def.bridge.getAppWeatherInfo(params) .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, testBridge(name){ switch(name){ case 'getWeatherInfo': this.getWeatherInfo() break; case 'getAppWeatherInfo': this.getAppWeatherInfo() break; default: break; } } }