Framework7 - 传递自定义上下文
描述
Framework7 允许您将自定义上下文传递给任何动态页面或任何已加载的 Ajax。
data-context 属性用于传递自定义上下文,您需要在其中放置有效的字符串化 JSON,如下所示 −
<a href = "interests.html" class = "item-link item-content" data-context = '{ "sport": "Baseball", "place": "Scotland", "movies": "Science Fiction", "actor": "Tom Cruise" }'>Interests</a>
您还可以使用 View 的路由器 .load() 方法和 JavaScript 中的 context 属性传递自定义上下文,如以下实例所示 −
mainView.router.load ({ url: 'interests.html', context: { sport: 'Baseball', place: 'Scotland', movies: 'Science Fiction', actor: 'Tom Cruise' } })
framework7_template7_pages.html