Skip to content

qin.css(OBJECT) ​

基于 createSelectorQuery 全平台统一的封装,用于获取宽度 ,高度,居上距离,居下距离。

平台兼容性说明

H5微信小程序小红书小程序抖音小程序快手小程序
√√√√√

OBJECT 参数说明

参数名类型必填说明平台差异说明
selectorString是createSelectorQuery 支持的所有选择器
cssString[]否可选值是 css 的样式
selfComponent否可选值是 this 。在组件中获取样式时候必传,查看

示例

在 setup 中如果获取不到,需要传递 self 参数。

js
import { getCurrentInstance } from 'vue';
import { onLoad } from '@fe6/qinjs-app';

const theThis = getCurrentInstance()?.proxy;
onLoad(async() => {
  const theTabDef = await qin.css({
    selector: '.home-tabs-item0',
    self: theThis,
  });
})
import { getCurrentInstance } from 'vue';
import { onLoad } from '@fe6/qinjs-app';

const theThis = getCurrentInstance()?.proxy;
onLoad(async() => {
  const theTabDef = await qin.css({
    selector: '.home-tabs-item0',
    self: theThis,
  });
})