DDCloud_LXHfeat: example
fa5dc483创建于 2024年4月17日历史提交
<template>
  <view class="page">
    <view class="flex-row">
      父组件:
      <text class="parent-msg">{{ msg }}</text>
    </view>
    <button class="parent-btn" @click="change">父组件改变数据</button>
    <child />
  </view>
</template>

<script setup lang="uts">
import child from './components/child.uvue'
import { setComponentMsg, state } from '@/store/index.uts'

const msg = computed<number>((): number => state.componentMsg)

const change = () => {
  setComponentMsg(state.componentMsg + 1)
}
</script>