var demo_str = `
    <div class="return_btn">
      <img :src="leftIcon" alt="" @click="handleClickReturn">
      <img :src="rightIcon" alt="">
    </div>
`;

var demoComponent = Vue.extend({
  template: demo_str,
  data: function() {
    // 初始化时先获取路径信息
    const isQwPath = window.location.pathname.includes('/qw')
    
    return {
      // 根据路径设置不同的图片路径
      leftIcon: isQwPath ? '../img/qw/back_left.png' : './img/qw/back_left.png',
      rightIcon: isQwPath ? '../img/qw/back_right.png' : './img/qw/back_right.png',
    }
  },
  created() {
    // console.log('当前页面路径', window.location.pathname)
  },
  methods: {
    handleClickReturn() {
      if (window.location.pathname.includes('/qw/clientMassList.html')
        || window.location.pathname.includes('/qw/clientGroupMassList.html')
        || window.location.pathname.includes('/qw/pyqMassList.html')) {  
        var currentQueryParams = window.location.search;
        window.location.replace('../WeCom.html' + currentQueryParams)
      } else {
        window.history.back()
      }
    }
  },
});

Vue.component('page-return', demoComponent);