最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use JS in Statamic templates? - Stack Overflow

programmeradmin3浏览0评论

I want to import js file in some antlers template and use in it function from js file Example:

<div id="logout" class="logout hidden" onclick="logout()">
  <i class="material-icons">logout</i>
</div>
{{ vite src="resources/js/header.js" }}

Header.js:

function logout(){
  return apiService.get('/logout')
}

But in console I have error that

"TypeError: logout is not a function at HTMLDivElement.onclick"

How to use JS in Statamic CMS template???

发布评论

评论列表(0)

  1. 暂无评论