<script>
function setWidth(width) {
if (width > 1600) return "xlg-max";
else if (width < 1600 && width > 1366) return "xlg";
else if (width < 1366 && width > 1280) return "lg";
else if (width < 1280 && width > 1024) return "md";
else if (width < 1024 && width > 768) return "tablet";
else if (width < 768 && width > 480) return "sm";
else if (width < 480) return "xs";
}
import { onMounted, provide, reactive, computed } from "vue";
import { useStore } from "vuex";
export default {
name: "App",
setup() {
let windowSize = reactive({
width: 0,
breakpoint: null,
});
provide("windowSize", windowSize);
function setWindowSize() {
windowSize.breakpoint = setWidth(window.innerWidth);
windowSize.width = window.innerWidth;
}
onMounted(() => {
setWindowSize();
window.addEventListener("resize", setWindowSize);
});
const store = useStore();
store.dispatch("boards/getBoards").then((event) => console.log(event));
const boards = computed(() => {
return store.getters["boards/getBoards"];
});
return boards;
},
};
</script>
Не работает computed, даже есть просто возвращать в нем примитив, что не так?