分段式 Svelte 組件

包括以下組件

按鈕屬性

按鈕元件具有與 連結 元件幾乎相同的屬性,但多了幾個按鈕專屬屬性

屬性類型預設值說明
<Segmented> 屬性
raised布林值false使分段按鈕凸起
raisedIos布林值false僅在 iOS 主題中使分段按鈕凸起
raisedMd布林值false僅在 MD 主題中使分段按鈕凸起
round布林值false使分段按鈕圓形
roundIos布林值false僅在 iOS 主題中使分段按鈕圓形
roundMd布林值false僅在 MD 主題中使分段按鈕圓形
strong布林值false使分段按鈕粗體
strongIos布林值false僅在 iOS 主題中使分段按鈕粗體
strongMd布林值false僅在 MD 主題中使分段按鈕粗體
tag字串div用於呈現分段元素的標籤。可以是 divp

範例

segmented.svelte
<script>
  import { Page, Navbar, Block, Segmented, Button } from 'framework7-svelte';

  let activeStrongButton = 0;
</script>

<!-- svelte-ignore a11y-invalid-attribute -->
<Page>
  <Navbar title="Segmented" />

  <Block strong outlineIos>
    <Segmented tag="p">
      <Button>Button</Button>
      <Button>Button</Button>
      <Button active>Active</Button>
    </Segmented>
    <Segmented strong tag="p">
      <Button active={activeStrongButton === 0} onClick={() => (activeStrongButton = 0)}
        >Button</Button
      >
      <Button active={activeStrongButton === 1} onClick={() => (activeStrongButton = 1)}
        >Button</Button
      >
      <Button active={activeStrongButton === 2} onClick={() => (activeStrongButton = 2)}
        >Button</Button
      >
    </Segmented>
    <Segmented raised tag="p">
      <Button>Button</Button>
      <Button>Button</Button>
      <Button active>Active</Button>
    </Segmented>
    <Segmented tag="p">
      <Button outline>Outline</Button>
      <Button outline>Outline</Button>
      <Button outline active>Active</Button>
    </Segmented>
    <Segmented raised round tag="p">
      <Button round>Button</Button>
      <Button round>Button</Button>
      <Button round active>Active</Button>
    </Segmented>
    <Segmented round tag="p">
      <Button round outline>Outline</Button>
      <Button round outline>Outline</Button>
      <Button round outline active>Active</Button>
    </Segmented>
  </Block>
</Page>
在此頁面