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