如果您將 Konsta UI 與其他框架(如 Framework7)一起使用,我們仍然應該借助 KonstaProvider
指定 Konsta UI 的全域設定(如主題)。
我們還需要將 k-ios
或 k-material
類別新增至應用程式的根元素。
<!-- App.svelte -->
<script>
// we use main App and Router components from Framework7
import { App, View, Page, Navbar } from 'framework7-svelte';
// we use KonstaProvider instead
import { KonstaProvider, Block, Button } from 'konsta/svelte';
</script>
<!-- Wrap our app with KonstaProvider -->
<KonstaProvider theme="ios">
<!-- We add extra `k-ios` class to the app root element -->
<App theme="ios" class="k-ios">
<View>
<Page>
<Navbar title="My App" />
<!-- Konsta UI components -->
<Block>
<p>Here comes my app</p>
</Block>
<Block class="space-y-4">
<p>Here comes the button</p>
<Button>Action</Button>
</Block>
</Page>
</View>
</App>
</KonstaProvider>
名稱 | 類型 | 預設值 | 描述 |
---|---|---|---|
dark | 布林值 | false | 包含 |
theme | 'ios' | 'material' | 'parent' | 'material' | 應用程式主題。如果設定為 |
touchRipple | 布林值 | true | 在 Material 主題中啟用觸控漣漪效果。允許全域停用所有元件的觸控漣漪 |