SHARE
TWEET

Untitled

a guest Jun 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. import PageView from '....'
  3. export default {
  4.     components:[PageView],
  5.     data () {
  6.         return {
  7.             loading: false,
  8.             page: null,
  9.             error: null
  10.         }
  11.     },
  12.     created () {
  13.         this.getPage()
  14.     },
  15.     watch: {
  16.         '$route': 'getPage'
  17.     },
  18.     methods: {
  19.         getPage () {
  20.             this.error = this.page = null
  21.             this.loading = true
  22.  
  23.             axios.get('/page/' + this.$route.params.uid)
  24.                 .then((response) => {
  25.                     this.loading = false
  26.                     this.page = response.data
  27.                 })
  28.                 .catch((error) => this.error = error.toString());
  29.         }
  30.     }
  31. }
  32. </script>
RAW Paste Data
Want to get better at JavaScript?
Learn to code JavaScript in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top