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