未截取前
截取后
方法:
</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); }); } } }