<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>
<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>
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='选择月';
}
},
}
Header 不支持设置跨域相关字段,需要到 Bucket 设置的 CORS 配置里配。
另外如果请求的时候想带 Header,应该这样写:
cos.sliceUploadFile({
Bucket: 'test',
Region: 'ap-guangzhou',
Key: '1.zip',
FilePath: './1.zip'
Headers:{
'x-cos-meta-xxx': 'xxx'
}
}, function (err, data) {
console.log(err, data);
});
var COS = require('cos-nodejs-sdk-v5');
// 创建实例
var cos = new COS({
AppId: '1250000000',
SecretId: 'AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
SecretKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
});
// 分片上传
cos.sliceUploadFile({
Bucket: 'test',
Region: 'ap-guangzhou',
Key: '1.zip',
FilePath: './1.zip'
}, function (err, data) {
console.log(err, data);
});
这样写试试,这里我用的是nodejs,如果你用的是js语言,可能需要重写。