mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-18 20:44:48 -04:00
fix js mediaquery in ace1.0
This commit is contained in:
@@ -34,16 +34,16 @@ import { requireModule } from '../page/register';
|
||||
*/
|
||||
export interface MediaQueryInfo {
|
||||
'orientation': string;
|
||||
'deviceType': string;
|
||||
'deviceWidth': string;
|
||||
'deviceHeight': string;
|
||||
'roundScreen': boolean;
|
||||
'device-type': string;
|
||||
'device-width': string;
|
||||
'device-height': string;
|
||||
'round-screen': boolean;
|
||||
'width': string;
|
||||
'height': string;
|
||||
'isInit': boolean;
|
||||
'resolution': string;
|
||||
'aspectRatio': string;
|
||||
'darkMode': string;
|
||||
'aspect-ratio': string;
|
||||
'dark-mode': string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -90,12 +90,6 @@ export class MediaQueryApi {
|
||||
if (!this._mqlArray || this._mqlArray.length === 0) {
|
||||
return;
|
||||
}
|
||||
data['device-type'] = data.deviceType;
|
||||
data['aspect-ratio'] = data.aspectRatio;
|
||||
data['device-width'] = data.deviceWidth;
|
||||
data['device-height'] = data.deviceHeight;
|
||||
data['round-screen'] = data.roundScreen;
|
||||
data['dark-mode'] = data.darkMode;
|
||||
for (let i = 0; i < this._mqlArray.length; i++) {
|
||||
const mediaQueryList:MediaQueryList = this._mqlArray[i];
|
||||
const result: boolean = matchMediaQueryCondition(mediaQueryList.condition, data, true);
|
||||
|
||||
@@ -189,12 +189,12 @@ export default class Vm {
|
||||
this.mediaStatus.width = this._app.options.width;
|
||||
this.mediaStatus.height = this._app.options.height;
|
||||
this.mediaStatus.resolution = this._app.options.resolution;
|
||||
this.mediaStatus['device-type'] = this._app.options.deviceType;
|
||||
this.mediaStatus['aspect-ratio'] = this._app.options.aspectRatio;
|
||||
this.mediaStatus['device-width'] = this._app.options.deviceWidth;
|
||||
this.mediaStatus['device-height'] = this._app.options.deviceHeight;
|
||||
this.mediaStatus['round-screen'] = this._app.options.roundScreen;
|
||||
this.mediaStatus['dark-mode'] = this._app.options.darkMode;
|
||||
this.mediaStatus['device-type'] = this._app.options['device-type'];
|
||||
this.mediaStatus['aspect-ratio'] = this._app.options['aspect-ratio'];
|
||||
this.mediaStatus['device-width'] = this._app.options['device-width'];
|
||||
this.mediaStatus['device-height'] = this._app.options['device-height'];
|
||||
this.mediaStatus['round-screen'] = this._app.options['round-screen'];
|
||||
this.mediaStatus['dark-mode'] = this._app.options['dark-mode'];
|
||||
|
||||
// If there is no parentElement, specify the documentElement.
|
||||
this._parentEl = parentEl || this._app.doc.documentElement;
|
||||
|
||||
@@ -41,11 +41,11 @@ describe('use defineFn/bootstrap', () => {
|
||||
let doc: Document;
|
||||
const options = {
|
||||
orientation: 'portrait',
|
||||
deviceType: 'phone',
|
||||
'device-type': 'phone',
|
||||
resolution: '3.0',
|
||||
aspectRatio: 'string',
|
||||
deviceWidth: '1176',
|
||||
deviceHeight: '2400',
|
||||
'aspect-ratio': 'string',
|
||||
'device-width': '1176',
|
||||
'device-height': '2400',
|
||||
width: '0',
|
||||
height: '0',
|
||||
isInit: true,
|
||||
|
||||
@@ -40,17 +40,17 @@ describe('receiveTasks', () => {
|
||||
const instanceId = Date.now() + '';
|
||||
const options = {
|
||||
orientation: 'portrait',
|
||||
deviceType: 'phone',
|
||||
'device-type': 'phone',
|
||||
resolution: '3.0',
|
||||
aspectRatio: 'string',
|
||||
deviceWidth: '1176',
|
||||
deviceHeight: '2400',
|
||||
'aspect-ratio': 'string',
|
||||
'device-width': '1176',
|
||||
'device-height': '2400',
|
||||
roundScreen: false,
|
||||
width: '0',
|
||||
height: '0',
|
||||
isInit: true,
|
||||
pcPreview: 'disable',
|
||||
darkMode: 'false',
|
||||
'dark-mode': 'false',
|
||||
appInstanceId: '10002',
|
||||
packageName: 'com.example.helloworld',
|
||||
resourcesConfiguration: [],
|
||||
|
||||
Reference in New Issue
Block a user