wyiot-components
v0.1.4
Published
一个基于 Vue 3 的组件库,提供常用的业务组件。
Readme
Wyiot Components
一个基于 Vue 3 的组件库,提供常用的业务组件。
安装
# 使用 npm
npm install wyiot-components
# 使用 yarn
yarn add wyiot-components
# 使用 pnpm
pnpm add wyiot-componentsCDN 使用
<!-- 引入 Vue 3 -->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<!-- 引入 Element Plus -->
<script src="https://unpkg.com/element-plus"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/wyiot-components"></script>
<script>
const app = Vue.createApp({})
app.use(WyiotComponents)
app.mount('#app')
</script>使用示例
Vue 3 项目中使用
<template>
<AlarmSetting
:initial-timeout-alarm="true"
:initial-speed-alarm="false"
@save="handleSave"
@timeout-change="handleTimeoutChange"
@speed-change="handleSpeedChange"
/>
</template>
<script setup>
import { AlarmSetting } from 'wyiot-components'
const handleSave = (settings) => {
console.log('保存设置:', settings)
}
const handleTimeoutChange = (value) => {
console.log('超时报警状态改变:', value)
}
const handleSpeedChange = (value) => {
console.log('超速报警状态改变:', value)
}
</script>组件说明
AlarmSetting 组件
报警设置组件,提供超时报警和超速报警的开关设置。
Props
initialTimeoutAlarm: Boolean - 初始超时报警状态,默认 falseinitialSpeedAlarm: Boolean - 初始超速报警状态,默认 false
Events
save: 保存设置时触发,参数为当前设置状态timeout-change: 超时报警状态改变时触发speed-change: 超速报警状态改变时触发
