mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 08:57:19 +08:00
2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
import{r as p,i as o,b as u,aE as c}from"./index-WGKmNNf0.js";function b(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!c(a)}function m(){const a=p([]),n=[{value:0,label:"上午写代码"},{value:1,label:"下午写代码"},{value:2,label:"晚上写代码"},{value:3,label:"凌晨休息了"}],d=[{label:"姓名",prop:"name",cellRenderer:({row:e})=>o(u("el-input"),{modelValue:e.name,"onUpdate:modelValue":l=>e.name=l},null)},{label:"性别",prop:"sex",cellRenderer:({row:e})=>o(u("el-switch"),{modelValue:e.sex,"onUpdate:modelValue":l=>e.sex=l,"inline-prompt":!0,"active-value":0,"inactive-value":1,"active-text":"男","inactive-text":"女"},null)},{label:"爱好",prop:"hobby",cellRenderer:({row:e})=>{let l;return o(u("el-select"),{modelValue:e.hobby,"onUpdate:modelValue":t=>e.hobby=t,clearable:!0,placeholder:"请选择爱好"},b(l=n.map(t=>o(u("el-option"),{key:t.value,label:t.label,value:t.value},null)))?l:{default:()=>[l]})}},{label:"日期",prop:"date",cellRenderer:({row:e})=>o(u("el-date-picker"),{modelValue:e.date,"onUpdate:modelValue":l=>e.date=l,type:"date",format:"YYYY/MM/DD","value-format":"YYYY-MM-DD",placeholder:"请选择日期"},null),minWidth:110},{label:"操作",fixed:"right",width:90,slot:"operation"}];function r(){a.value.push({id:a.value.length+1,name:"",sex:0,hobby:"",date:""})}function i(e){const l=a.value.indexOf(e);l!==-1&&a.value.splice(l,1)}return{columns:d,dataList:a,onAdd:r,onDel:i}}export{m as useColumns};
|