Framework7-templates-pass-context
提供:Dev Guides
カスタムコンテキストを渡す
説明
Framework7では、カスタムコンテキストを任意の動的ページまたは読み込まれたAjaxに渡すことができます。
_data-context_属性は、以下に示すように、有効な文字列化されたJSONを配置する必要があるカスタムコンテキストを渡すために使用されます-
<a href = "interestsl" class = "item-link item-content" data-context = '{
"sport": "Baseball",
"place": "Scotland",
"movies": "Science Fiction",
"actor": "Tom Cruise"
}'>Interests</a>
次の例に示すように、JavaScriptでViewのrouter _.load()_メソッドとコンテキストプロパティを使用してカスタムコンテキストを渡すこともできます-
mainView.router.load ({
url: 'interestsl',
context: {
sport: 'Baseball',
place: 'Scotland',
movies: 'Science Fiction',
actor: 'Tom Cruise'
}
})