Files

2 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2026-04-07 02:04:22 +05:30
import{ay as a}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as s,R as f,a0 as c,t as p,c as h}from"./vue-core-DJjvd5ZC.js?v=1773287522785";const y=s({functional:!0,props:{value:{type:[String,Number,Boolean],default:void 0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],checkedValue:{type:[String,Number,Boolean],default:!0},uncheckedValue:{type:[String,Number,Boolean],default:!1},onChange:[Function,Array],showText:{type:Boolean,default:!0},checkedLabel:{type:String,default:""},uncheckedLabel:{type:String,default:""}},setup(e){const t=p(e,"value"),r=h(()=>t.value===e.checkedValue);function l(n){const{"onUpdate:value":u,onChange:o,onUpdateValue:i}=e;u&&a(u,n),i&&a(i,n),o&&a(o,n)}function d(){t.value!==e.checkedValue?l(e.checkedValue):l(e.uncheckedValue)}return{checked:r,onClick:d}},render(){const{checked:e}=this,{t}=f();return c("div",{class:"inline-flex gap-2px items-center cursor-pointer",onClick:()=>{this.onClick()}},[this.showText?c("span",{class:e?"text-primary":"text-error"},[e?this.checkedLabel||t("Public.Status.Running"):this.uncheckedLabel||t("Public.Status.Stop")]):"",c("span",{class:["text-14px",e?"i-mage:play-fill text-primary":"i-mage:pause-fill text-error"]},null)])}});export{y as _};