Merge branch 'master' of https://github.com/Tencent/omi
This commit is contained in:
commit
7801dac815
|
@ -29,9 +29,9 @@ HelloWrold.vue:
|
|||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<button @click="store.sub">-</button>
|
||||
<button @click="$store.sub">-</button>
|
||||
<span>{{state.count}}</span>
|
||||
<button @click="store.add">+</button>
|
||||
<button @click="$store.add">+</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -108,9 +108,9 @@ HelloWorld.vue:
|
|||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<button @click="store.cs.sub">-</button>
|
||||
<button @click="$store.cs.sub">-</button>
|
||||
<span>{{state.cs.count}}</span>
|
||||
<button @click="store.cs.add">+</button>
|
||||
<button @click="$store.cs.add">+</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -150,7 +150,7 @@ render(App, '#app', new class {
|
|||
Bind `getDoubleCount` to template:
|
||||
|
||||
```html
|
||||
<div>double: {{store.getDoubleCount()}}</div>
|
||||
<div>double: {{$store.getDoubleCount()}}</div>
|
||||
```
|
||||
|
||||
## Differences to Vuex
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omiv v1.0.0 https://tencent.github.io/omi/
|
||||
* omiv v1.0.1 https://tencent.github.io/omi/
|
||||
* 1kb store system for Vue apps.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -418,7 +418,7 @@
|
|||
|
||||
function applyMixin(Vue) {
|
||||
var omivComputed = {
|
||||
state: function state() {
|
||||
$state: function $state() {
|
||||
if (isMultiStore) {
|
||||
var state = {};
|
||||
Object.keys(this.$store).forEach(function (k) {
|
||||
|
@ -427,9 +427,6 @@
|
|||
return state;
|
||||
}
|
||||
return this.$store.data;
|
||||
},
|
||||
store: function store() {
|
||||
return this.$store;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omiv v1.0.0 https://tencent.github.io/omi/
|
||||
* omiv v1.0.1 https://tencent.github.io/omi/
|
||||
* 1kb store system for Vue apps.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -415,7 +415,7 @@ function install(_Vue) {
|
|||
|
||||
function applyMixin(Vue) {
|
||||
var omivComputed = {
|
||||
state: function state() {
|
||||
$state: function $state() {
|
||||
if (isMultiStore) {
|
||||
var state = {};
|
||||
Object.keys(this.$store).forEach(function (k) {
|
||||
|
@ -424,9 +424,6 @@ function applyMixin(Vue) {
|
|||
return state;
|
||||
}
|
||||
return this.$store.data;
|
||||
},
|
||||
store: function store() {
|
||||
return this.$store;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -295,7 +295,7 @@
|
|||
}
|
||||
}
|
||||
var omivComputed = {
|
||||
state: function() {
|
||||
$state: function() {
|
||||
if (isMultiStore) {
|
||||
var state = {};
|
||||
Object.keys(this.$store).forEach(function(k) {
|
||||
|
@ -304,9 +304,6 @@
|
|||
return state;
|
||||
}
|
||||
return this.$store.data;
|
||||
},
|
||||
store: function() {
|
||||
return this.$store;
|
||||
}
|
||||
};
|
||||
Vue.mixin({
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<button @click="store.cs.sub">-</button>
|
||||
<span>{{state.cs.count}}</span>
|
||||
<button @click="store.cs.add">+</button>
|
||||
<div>double: {{store.cs.getDoubleCount()}}</div>
|
||||
<span>{{state.ns.name}}</span>
|
||||
<button @click="$store.cs.sub">-</button>
|
||||
<span>{{$state.cs.count}}</span>
|
||||
<button @click="$store.cs.add">+</button>
|
||||
<div>double: {{$store.cs.getDoubleCount()}}</div>
|
||||
<span>{{$state.ns.name}}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<button @click="store.sub">-</button>
|
||||
<span>{{state.count}}</span>
|
||||
<button @click="store.add">+</button>
|
||||
<div>double: {{store.getDoubleCount()}}</div>
|
||||
<button @click="$store.sub">-</button>
|
||||
<span>{{$state.count}}</span>
|
||||
<button @click="$store.add">+</button>
|
||||
<div>double: {{$store.getDoubleCount()}}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omiv",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "1kb store system for Vue apps.",
|
||||
"main": "dist/omiv.js",
|
||||
"jsnext:main": "dist/omiv.esm.js",
|
||||
|
|
|
@ -189,7 +189,7 @@ export function install(_Vue) {
|
|||
|
||||
function applyMixin(Vue) {
|
||||
const omivComputed = {
|
||||
state() {
|
||||
$state() {
|
||||
if (isMultiStore) {
|
||||
let state = {}
|
||||
Object.keys(this.$store).forEach(k => {
|
||||
|
@ -198,9 +198,6 @@ function applyMixin(Vue) {
|
|||
return state
|
||||
}
|
||||
return this.$store.data
|
||||
},
|
||||
store() {
|
||||
return this.$store
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<span class="count">{{ state.count }}</span>
|
||||
<button @click="store.add">Increment</button>
|
||||
<span class="count">{{ $state.count }}</span>
|
||||
<button @click="$store.add">Increment</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div id='app'>
|
||||
<span class="count">{{ state.count }}</span>
|
||||
<span class="count">{{ $state.count }}</span>
|
||||
<button @click="$store.add">Increment</button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div id='app'>
|
||||
<span class="count">{{ state.count }}</span>
|
||||
<span class="count">{{ $state.count }}</span>
|
||||
<button @click="$store.add">Increment</button>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<span class="count">{{ state.count }}</span>
|
||||
<button id="btn" @click="store.add">Increment</button>
|
||||
<span class="count">{{ $state.count }}</span>
|
||||
<button id="btn" @click="$store.add">Increment</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<span class="count">{{ state.cs.count }}</span>
|
||||
<button id="btn" @click="store.cs.sub">sub</button>
|
||||
<span class="count">{{ $state.cs.count }}</span>
|
||||
<button id="btn" @click="$store.cs.sub">sub</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<div>{{state.count}}</div>
|
||||
<button id="btn" @click="store.add"></button>
|
||||
<Child :title='state.title' />
|
||||
<div>{{$state.count}}</div>
|
||||
<button id="btn" @click="$store.add"></button>
|
||||
<Child :title='$state.title' />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<span class="count">{{ state.count }}</span>
|
||||
<button @click="store.add">Increment</button>
|
||||
<span class="count">{{ $state.count }}</span>
|
||||
<button @click="$store.add">Increment</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue