美文网首页
vue 移动端下载中转页

vue 移动端下载中转页

作者: 夜息白鸽 | 来源:发表于2018-11-13 17:30 被阅读0次

安卓用户访问走安卓链接
ios用户访问走ios链接
简单写个笔记 下次直接复制粘贴

<template>
  <div id="app">
    <div class="logo">
      <img src="./assets/logo@2x.png" >
    </div>
    <div class="down_info">
      <p>{{version}}</p>
      <button type="button" name="button" class="down_bnt" @click.stop="downApp">下载</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      version: '项目名称 for Android',
      iosLink: 'https://*************************&platform=ios',
      androidLink: 'https://*************************&platform=android',
      downloadLink: ''
    }
  },
  created () {
    if (this.isIOS()) {
      this.downloadLink = this.iosLink
      this.version = '项目名称 for Ios'
    } else {
      this.downloadLink = this.androidLink
      this.version = '项目名称 for Android'
    }
    // window.location.href= this.downloadLink
  },
  methods: {
    isIOS () {
      var u = navigator.userAgent
      return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
    },
    downApp () {
      window.location.href = this.downloadLink
    }
  }
}
</script>


相关文章

网友评论

      本文标题:vue 移动端下载中转页

      本文链接:https://www.haomeiwen.com/subject/jdblfqtx.html