/**
 * add Vue-Router support
 */
export default {
  props: {
    url: String,
    target: String,
    replace: Boolean,
    to: [String, Object]
  },
  methods: {
    routerLink: function routerLink() {
      var to = this.to,
          url = this.url,
          target = this.target,
          $router = this.$router,
          replace = this.replace;

      if (to && $router) {
        $router[replace ? 'replace' : 'push'](to);
      } else if (url) {
        replace ? location.replace(url) : location.href = url;
      } else if (target) {
        window.open(target, '_blank');
      }
    }
  }
};