天天看點

IE9浏覽器下的 placeholder不顯示的解決方案

查了很多資料,關于ie浏覽器的相容問題

最後采取了label的替代方案

/* input placeholder 實作的替代方案 */
.circle-panel .input-label-placeholder{
  position: absolute;
  left: 50px;
  top: 38px;
  z-index: 1;
  font-size: 24px;
  color: #cccccc;
}

.modal-body-rgt .label-placeholder {
  position: absolute;
  left: 0px;
  top: 0;
  z-index: 1;
  font-size: 15px;
  color: #cccccc;
}

.time-placeholder{
  position: absolute;
  left: 10px;
  top: 3px;
  z-index: 1;
  font-size: 15px;
  color: #cccccc;
}
  <Form.Item
          label={t('pageLogbook:labelTime')}
          {...formLgItemLayout}
        >
          {
           !sp && !getFieldValue('sportTime') &&<label className="time-placeholder">{t('validation:noselectTime')}</label>
          }
          <DatePicker
            format="yyyy/MM/dd HH:mm"
            showTime={{ format: 'HH:mm', getPopupContainer: trigger => trigger.parentNode }}
            disabledDate={this.setDisabledDate}
            getCalendarContainer={trigger => trigger.parentNode}
            {...timeProps}
          />
        </Form.Item>
           
<FormItem label={sp ? undefined : "手機号"}>
                <Input
                  type="phone"
                  placeholder="手機号"
                  {...phoneProps}
                />
     </FormItem>