This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
fmt.Println("main execution started") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func numbers() { | |
for i := 1; i <= 5; i++ { | |
time.Sleep(250 * time.Millisecond) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func printHello() { | |
time.Sleep(time.Millisecond) | |
fmt.Println("Hello World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func printHello() { | |
fmt.Println("Hello World!") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func printHello() { | |
fmt.Println("Hello World!") | |
} | |
func main() { | |
fmt.Println("main execution started") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import Router from 'vue-router' | |
Vue.use(Router) | |
function lazyLoad(view){ | |
return() => import(`@/views/${view}.vue`) | |
} | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, | |
routes: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default new Router({ | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home | |
}, | |
{ | |
path: '/about', | |
name: 'about', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import Router from 'vue-router' | |
import Home from './views/Home.vue' | |
import About from './views/About.vue' | |
Vue.use(Router) | |
export default new Router({ | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/products/_id.vue | |
export default { | |
asyncData(context) { | |
return axios.get(`https://my-api-server/api/products/${params.id}, (response) => { | |
return { product: response.data }; | |
}); | |
} | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/products/_id.vue | |
export default { | |
fetch(({ store, params }) { | |
if (typeof (store.state.products.byId[params.id]) === 'undefined') { | |
return store.dispatch('products/loadProduct', {id: params.id}); | |
} | |
} | |
... | |
} |