解决方案:
给 state 增加 computed
import { useLayerStore } from "@/stores/"; const layer = useLayerStore(); const layerList = computed(() => layer.layerList);
<div v-for="(layer, index) in layerList" :key="layer.id" class="layer-item"> <div>{{ layer.name }}</div> </div>
标签:useLayerStore,computed,layerList,layer,state,pinia,vue3 From: https://www.cnblogs.com/beileixinqing/p/17264755.html