浏览代码

Updated docs - order matters w/ Alpine.data (#2064)

When upgrading a project to v3, I got tripped up by this. Betting other folks will skip straight to the upgrade guide like I did and not realize that order matters with how v3 is initialized on the page. This is the only thing I've encountered so far! Perhaps some background about why this is deprecated would also be useful? 

Is it deprecated because it's better to have these data functions scoped within Alpine, or do you expect the old (global) functions to no longer work in a future version?
Austen Cameron 3 年之前
父节点
当前提交
57136f33a7
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      packages/docs/src/en/upgrade-guide.md

+ 2 - 0
packages/docs/src/en/upgrade-guide.md

@@ -371,3 +371,5 @@ The following 2 APIs will still work in V3, but are considered deprecated and ar
     })
 </script>
 ```
+
+> Note that you need to define `Alpine.data()` extensions BEFORE you call `Alpine.start()`. For more information, refer to the [Lifecycle Concerns](https://alpinejs.dev/advanced/extending#lifecycle-concerns) and [Installation as a Module](https://alpinejs.dev/essentials/installation#as-a-module) documentation pages.