提交 0a34e41c 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(store): reactive warning

上级 43085e7a
<script lang="ts">
import { state, setLifeCycleNum } from './store/index.uts'
<script lang="uts">
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
onLaunch: function () {
// 自动化测试
......
......@@ -4,17 +4,21 @@
<view class="uni-padding-wrap">
<text>点击按钮调用 App.uvue methods</text>
<text class="margin-top:6px;">increasetLifeCycleNum 方法</text>
<button class="uni-common-mt" @click="_increasetLifeCycleNum">increase lifeCycleNum</button>
<button class="uni-common-mt" @click="_increasetLifeCycleNum">
increase lifeCycleNum
</button>
<text class="uni-common-mt">lifeCycleNum: {{ lifeCycleNum }}</text>
</view>
</view>
</template>
<script lang="ts">
import { state, setLifeCycleNum } from '@/store/index.uts'
<script lang="uts">
import { State, state, setLifeCycleNum } from '@/store/index.uts'
export default {
data() {
data() {
return {
_state: state as State,
lifeCycleNum: 0,
}
},
......
......@@ -16,11 +16,12 @@
</view>
</template>
<script lang="ts">
<script lang="uts">
class Page {
constructor(public route : string) {
}
}
export default {
data() {
return {
......
......@@ -12,7 +12,7 @@
</view>
</template>
<script lang="ts">
<script lang="uts">
export default {
data() {
return {
......
......@@ -45,11 +45,13 @@
</view>
</template>
<script lang="ts">
import { state, setLifeCycleNum } from '@/store/index.uts'
<script lang="uts">
import { State, state, setLifeCycleNum } from '@/store/index.uts'
export default {
data() {
data() {
return {
_state: state as State,
onLoadTime: 0,
onShowTime: 0,
onReadyTime: 0,
......
......@@ -9,8 +9,9 @@
</view>
</template>
<script lang="ts">
<script lang="uts">
import { state } from '@/store/index.uts'
export default {
data() {
return {
......
......@@ -5,11 +5,13 @@
</view>
</template>
<script lang="ts">
import { state, setLifeCycleNum } from '@/store/index.uts'
<script lang="uts">
import { State, state, setLifeCycleNum } from '@/store/index.uts'
export default {
data() {
data() {
return {
_state: state as State,
isScrolled: false,
}
},
......
<template>
<view>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置导航条背景绿色,标题白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
</view>
</view>
</template>
<script lang="ts">
import { state, setLifeCycleNum } from '@/store/index.uts'
export default {
methods: {
<template>
<view>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置导航条背景绿色,标题白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
</view>
</view>
</template>
<script lang="uts">
import { State, state, setLifeCycleNum } from '@/store/index.uts'
export default {
data() {
return {
_state: state as State
}
},
methods: {
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
......@@ -51,24 +57,24 @@ export default {
setLifeCycleNum(state.lifeCycleNum + 1)
}
})
},
// 自动化测试
getLifeCycleNum(): number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num: number) {
setLifeCycleNum(num)
},
},
}
</script>
<style>
.direction-row {
flex-direction: row;
}
.label {
width: 190px;
}
</style>
},
// 自动化测试
getLifeCycleNum(): number {
return state.lifeCycleNum
},
// 自动化测试
setLifeCycleNum(num: number) {
setLifeCycleNum(num)
},
},
}
</script>
<style>
.direction-row {
flex-direction: row;
}
.label {
width: 190px;
}
</style>
type State = {
export type State = {
lifeCycleNum: number
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册