首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >俩个按钮动态切换日期类型等出现点击报错问题,不知道什么问题?

俩个按钮动态切换日期类型等出现点击报错问题,不知道什么问题?

提问于 2019-10-30 18:34:02
回答 1关注 0查看 410
代码语言:javascript
复制
<div style="margin-bottom: 20px">
    <el-radio-group v-model="formInline.dateType" @change="radioOptions" size="small">
      <el-radio label="1" border>按天</el-radio>
      <el-radio label="2" border>按月</el-radio>
    </el-radio-group>
</div>
代码语言:javascript
复制
<el-form-item :label="dateTime.lableTime">
    <el-date-picker v-model="formInline.searchTime" arrow-control
        :type="dateTime.type" :format="dateTime.format"
        :picker-options="pickerOptions" :value-format="dateTime.valueFormat" :placeholder="dateTime.placeholder">
    </el-date-picker>
</el-form-item>
代码语言:javascript
复制
data() {
    return {
        formInline: {
            shopSid: '',
            dateType: '2',
            searchTime: ''
        },
        dateTime:{
            lableTime:'月份',
            type:'month',
            format:'yyyy/MM',
            valueFormat:'yyyy-MM',
            placeholder:'选择月'
        },
   }
}
 methods: {
 radioOptions(){
            if (this.formInline.dateType==1){
                console.log(this.formInline.dateType)
                this.dateTime.lableTime='日份'
                this.dateTime.type='date'
                this.dateTime.format='yyyy/MM/dd'
                this.dateTime.valueFormat='yyyy-MM-dd'
                this.dateTime.placeholder='选择日'
            }else{
                this.dateTime.lableTime='月份';
                this.dateTime.type='month';
                this.dateTime.format='yyyy/MM';
                this.dateTime.valueFormat='yyyy-MM';
                this.dateTime.placeholder='选择月';
            }
        },
 }
 
 

俩个按钮切换后,日期点击报错
俩个按钮切换后,日期点击报错

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档