JSFiddle - React, Tailwind, and code Playground

by reshma_shenoy

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.min.js"></script>
<div id="example">
  Visit : <a href="#">{{cleanUrl}}</a><br><br>
  <input type="text" v-model="url" placeholder="Type your Url">
  <button @click="humanizeUrl">humanizeUrl</button>
</div>

JavaScript

var example1 = new Vue({
  el: '#example',
  data: {
    message: "Hello vue js",
    url: "",
    cleanUrl: ""
  },
  methods : {
  	humanizeUrl: function(){
      this.cleanUrl = this.url.replace(/^https?:\/\//, '').replace(/\/$/, '')
    }
  }
})