0.2.8 • Published 2 years ago

cz-front v0.2.8

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Summary

cz-front is based on vue3 + bootstrap5, it strengthen the bootstrap5 by vue3 but without change that

Init

main.ts

import { createApp } from 'vue'
import App from './App.vue'

// @ts-ignore
import cz from 'cz-front'
import 'cz-front/dist/style.css'

createApp(App).use(cz).mount('#app')

Api

alert

demo

const alertRef = ref()

<cz-alert ref="alertRef" type="primary">alert info</cz-alert>

<cz-button type="primary" @click="alertRef.show()">show alert</cz-button>
<cz-button type="danger" @click="alertRef.hide()">hide alert</cz-button>

props

namedescription
typedefault as 'primary' in 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'dark', 'light'

emits

namedescription
showno params
hideno params

expose

namedescription
showno params
hideno params

slots

namedescription
defaultno scope

badge

demo

<cz-badge type="danger" :rounded="true">99+</cz-badge>

props

namedescription
typedefault as 'primary' in 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'dark', 'light'
roundeddefault as false in true, false

slots

namedescription
defaultno scope

button、button-block、button-group

demo

const onclick = () => {
  alert(1)
}

<cz-button type="link" @click="onclick()">onclick</cz-button>

<cz-button-block>
  <cz-button type="primary" @click="onclick()">onclick</cz-button>
</cz-button-block>

<cz-button-group>
  <cz-button type="success" @click="onclick()">onclick</cz-button>
  <cz-button type="danger" @click="onclick()">onclick</cz-button>
</cz-button-group>

props

namedescription
typedefault as '' in '', 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'dark', 'light', 'link'
outlinedefault as false in true, false
sizedefault as '' in '', 'lg', 'sm'
loadingdefault as false in true, false
disableddefault as false in true, false

emits

namedescription
clickno params

slots

namedescription
defaultno scope

card

demo

<cz-card>
  <template #header>header</template>
  <template #default>default</template>
  <template #footer>footer</template>
</cz-card>

slots

namedescription
headerno scope
defaultno scope
footerno scope

carousel

demo

const picList = ref([
  { src: 'https://static.runoob.com/images/mix/img_fjords_wide.jpg' },
  { src: 'https://static.runoob.com/images/mix/img_nature_wide.jpg', label: 'Label' },
  { src: 'https://static.runoob.com/images/mix/img_mountains_wide.jpg', label: 'Label', desc: 'Desc!!!' }
])

<cz-carousel :items="picList"></cz-carousel>

props

namedescription
itemsa list like { src: '', label: '', desc: '' }

collapse、collapse-group

demo

<cz-collapse>
  <template #toggle>
    <cz-button>toggle</cz-button>
  </template>
  <template #default>default</template>
</cz-collapse>

<cz-collapse-group>
  <cz-collapse>
    <template #toggle>
      <cz-button>toggle1</cz-button>
    </template>
    <template #default>default1</template>
  </cz-collapse>

  <cz-collapse>
    <template #toggle>
      <cz-button>toggle2</cz-button>
    </template>
    <template #default>default2</template>
  </cz-collapse>

  <cz-collapse>
    <template #toggle>
      <cz-button>toggle3</cz-button>
    </template>
    <template #default>default3</template>
  </cz-collapse>
</cz-collapse-group>

slots

namedescription
toggleno scope
defaultno scope

dropdown

demo

const curDrop = ref(4)
const dropList = ref([
  { key: 0, label: 'Systems', type: 'header' },
  { key: 1, label: 'Users', type: 'item', disabled: true },
  { key: 2, label: 'Roles', type: 'item' },
  { type: 'divider' },
  { key: 3, label: 'Funcs', type: 'item' },
  { key: 4, label: 'Apis', type: 'item' }
])
const onchange = () => {
  alert()
}

<cz-dropdown
  v-model:value="curDrop"
  :items="dropList"
  placement="top"
  alignment="right"
  @change="onchange"
>
  <template #toggle>
    <cz-button type="primary">toggle</cz-button>
  </template>
</cz-dropdown>

props

namedescription
valuev-model
itemsa list like [ { key: '', label: '', type: 'a not null value in 'item', 'divider', 'header'', disabled: false } ]
placementdefault as '' in '', 'top', 'left', 'right'
alignmentdefault as '' in '', 'right'

emits

namedescription
changeparams as the selected key
update:valueparams as the selected key

slots

namedescription
toggleno scope

list-group

demo

const curGroup = ref(3)
const groupList = ref([
  { key: 1, label: 'Users', type: 'primary', disabled: true },
  { key: 2, label: 'Roles', type: 'primary' },
  { key: 3, label: 'Funcs', type: 'danger' },
  { key: 4, label: 'Apis', type: 'danger' }
])
const onchange = () => {
  alert()
}

<cz-list-group
  v-model:value="curGroup"
  :items="groupList"
  :horizontal="true"
  @change="onchange"
></cz-list-group>

props

namedescription
valuev-model
itemsa list like [ { key: '', label: '', type: 'a not null value in 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'dark', 'light'', disabled: false } ]
horizontaldefault as false in true, false
disableddefault as false in true, false

emits

namedescription
changeparams as the selected key
update:valueparams as the selected key

modal

demo

<cz-modal ref="modal" label="The Modal" @submit="inner.submit()">
    ...
</cz-modal>

props

namedescription
labelrequired string
closabledefault as true in true, false
readonlydefault as false in true, false
sizedefault as '' in '', 'sm', 'lg', 'xl', 'fullscreen'

emits

namedescription
submitno params

expose

namedescription
showno params
loadedno params, using for cancel the loading status after show()
submittedno params, using for cancel the submitting status during @submit
hideno params

slots

namedescription
defaultno scope

nav

0.2.8

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago