Vue中把從后端取出的時間進行截取


  未截取前

  截取后

  方法:

</div>{{times}}</div>
export default{
 data() { return { // getTime儲存從服務器請求回來的數據
           getTime:"" } }, computed:{ times(){ var s = this.getTime; // 將截取后的時間return出來 
          return s.substring(0,10) } }, mounted() { this.getData(); }, methods: { getData() { // 向服務器請求數據
      this.$http.get("/Movie/InfoMovieID="+this.$route.params.id) .then(res => { console.log(res.data); // 將請求回來的時間存到 getTime中
          this.getTime = res.data.ReleaseTime }) .catch(err => { console.log(err); }); } } }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM