Skip to content

Instantly share code, notes, and snippets.

View yyx990803's full-sized avatar

Evan You yyx990803

View GitHub Profile
const marky = require('marky')
const render = Vue.prototype._render
const update = Vue.prototype._update
const camelize = str => str && Vue.util.camelize(str)
function getName (vm) {
if (!vm.$parent) return 'root'
return (
camelize(vm.$options.name) ||
camelize(vm.$options._componentTag) ||
<script src="https://npmcdn.com/vue@next/dist/vue.js"></script>
<script src="https://npmcdn.com/vuex@next"></script>
<div id="app">
{{ count }}
<button @click="increment"> + </button>
<button @click="decrement"> - </button>
</div>
<script>
<script src="https://npmcdn.com/vue@next/dist/vue.js"></script>
<script src="https://npmcdn.com/vue-router@next"></script>
<style>
.router-link-active {
color: red;
}
</style>
<div id="app">
<side-bar></side-bar>
<script src="https://npmcdn.com/vue@next/dist/vue.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/animatecss/3.5.2/animate.min.css">
<style>
.done {
text-decoration: line-through;
}
.todo {
transition: all 0.5s ease;
height: 30px;

The Vue Stack

Opinionated stack for building large-scale, production grade applications

Application

  • View layer: Vue.js
    • Intuitive, smooth learning curve
    • Performant reactive system that is optimized by default
  • Built-in animation/transition system
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()
<!-- MyComponent.vue -->
<!-- css -->
<style>
.message {
color: red;
}
</style>
<!-- template -->
// 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: `
export default {
render () {
return <App><Text></Text></App>
}
}
// fesfesf
// fesfsef