elementUI

手风琴的title想变为动态的,不能用普通方法
手风琴title动态

<el-collapse-item :title="warningAlertTile">
  <WarningAlertList/>
 el-collapse-item>

js里面的写法

 warningAlertTile(){
   
   let warningAlertCount = this.warningAlerts.length;
   return `预报警(${
     warningAlertCount})`;
 }

会报错function () { [native code] }

修改:
使用get函数就行

get warningAlertTile(){
   
   let warningAlertCount = this.warningAlerts.length;
   return `预报警(${
     warningAlertCount})`;
 }

时间控件

可以选择日期的控件

 <el-row slot="middle" class="xhrow" :span="21">
         <el-card>
              <div slot="header">
                <div class="block">
                  <el-date-picker
                    :value="currentMon"
                    type="month"
                    @input="changeTime"
                    placeholder="选择月">
                  el-date-picker>
                div>
            div>
            <GridChiefLogger/> 
         el-card>
      el-row>

这里不能直接去改store的值,需要调store的函数去改,改了其他地方也就改了

  changeTime(newMon: Date){
   
    let newMonStr = moment(newMon).format("YYYY-MM")
    this.changeCurrentMon(newMonStr)
  }

下拉框控件

 <el-form-item label="级别" prop="grade">
    <el-select v-model="editPilot.grade" @change="changeSelect">
        <el-option
            v-for="option in options"
            :key="option.value"
            :value="option.value"
            :label="option.label"
        >el-option>
    el-select>
el-form-item>
editPilot: Pilot = newPilot([]);
options: any = [
   {
   
        value: "BVLOS",
        label: "视距内驾驶员"
    },
    {
   
        value: "VLOS",
        label: "超视距驾驶员"
    },
    {
   
        value: "INSTRUCTOR",
        label: "教员"
    },
];

动态下拉框控件

<el-select v-model="districtSelected" class="selectCss">
  <el-option
        v-for="item in districtList"
        :key="item.id"
        :label="item.name"
        :value="item.code"
    >el-option>
el-select>
@Getter districtList!: District[];
changeSelect(grade: string) {
   

你可能感兴趣的:(vue)