未截取前

  截取后

  方法:

</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);
        });
    }
  }
}

 

转载于:https://www.cnblogs.com/chenyang0710/p/10729743.html

Logo

前往低代码交流专区

更多推荐