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
var object = { | |
message: '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
<div id=”example”> | |
{{ message }} | |
</div> |
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
new Vue({ | |
el: ‘#example’, | |
data: object | |
}) |
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
var example = new Vue({ | |
data: { | |
a: 1 | |
}, | |
computed: { | |
b: function () { | |
return this.a + 1 | |
} | |
} | |
}) |
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
var Example = Vue.extend({ | |
template: '<div>{{ message }}</div>', | |
data: function () { | |
return { | |
message: 'Hello Vue.js!' | |
} | |
} | |
}) | |
// register it with the tag <example> |
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
<!-- MyComponent.vue --> | |
<!-- css --> | |
<style> | |
.message { | |
color: red; | |
} | |
</style> | |
<!-- template --> |
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 VueRouter from 'vue-router' | |
import App from './app.vue' | |
import ViewA from './view-a.vue' | |
import ViewB from './view-b.vue' | |
Vue.use(VueRouter) | |
const router = new VueRouter() |
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 { | |
render () { | |
return <App><Text></Text></App> | |
} | |
} | |
// fesfesf | |
// fesfsef |
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
// App.js | |
// using .jsx extension because gist syntax | |
// highlighting chokes on `export default` | |
import ComponentA from './ComponentA' | |
export default { | |
// use another component, in this scope only. | |
// ComponentA maps to the tag <component-a> | |
components: { ComponentA }, | |
template: ` |
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
// Turns a function's body into a worker | |
var workerify = function (func) { | |
if (typeof func !== 'function') { | |
throw new Error('expects a function to workerify.') | |
} | |
var script = func.toString().match(/^function[^{]*{((.|\n)*)}$/)[1], | |
blob = new Blob([script], {'type': 'application/javascript'}), | |
url = window.URL.createObjectURL(blob) | |
return new Worker(url) | |
} |