테마
bm.config()
- 블록 내 설정 값을 가져오거나 변경할 수 있어요.
bm.config(key)형식으로 설정 값을 가져오고,bm.config(key, value)형식으로 값을 설정해요.- 설정 값을 변경한 뒤에는
bm.apply()를 호출해야 블록에 반영돼요.
html
<template>
<h1>{{property.board.name}}</h1>
{{#each property.board.posts.data}}
<div>{{title}}</div>
{{/each}}
<button>다음 페이지</button>
</template>
<script>
const container = bm.container;
container.addEventListener('click', e => {
e.preventDefault();
if (e.target.matches('button')) {
// 현재 페이지 번호 가져오기
const currentPage = bm.config('property:board.posts.page');
// 다음 페이지로 설정
bm.config('property:board.posts.page', currentPage + 1);
// 변경사항 적용하고 블록 다시 그리기
bm.apply();
}
}, true);
</script>