小程序通过场景值跳转到相应的界面Vue

<script>

export default {
  onLaunch: function (options) {
	  console.log('app onLoad');
	  console.log(options);  
    var logs = uni.getStorageSync('logs') || [];
    logs.unshift(Date.now());
    uni.setStorageSync('logs', logs);
  },
  onShow:function(options){
	 console.log('app onShow');
	 console.log(options);
	 const {path,query,scene} = options;
	 console.log(scene);
	 //query
	 let sceneurl = decodeURIComponent(query.scene);
	 console.log('sceneurl ' + sceneurl);
	 //let sceneurl = decodeURIComponent(tempscene); 
	 if(sceneurl && sceneurl.toString().indexOf("?") != -1){
		 console.log('inner');
		 uni.navigateTo({
		     url: path + sceneurl
		 });
	 }
  },
  globalData: {},
  methods: {}
};
</script>
<style>
@import "./app.css";
</style>

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?