1234567891011121314151617181920212223242526 |
- // index.ts
- // 获取应用实例
- const app = getApp<IAppOption>()
- Component({
- data: {
- width: 300,
- height: 300,
- renderWidth: 300,
- renderHeight: 300,
- },
- methods: {
- // 事件处理函数
- onLoad() {
- const info = wx.getSystemInfoSync();
- const width = info.windowWidth;
- const height = info.windowHeight;
- const dpi = info.pixelRatio;
- this.setData({
- width, height,
- renderWidth: width * dpi,
- renderHeight: height * dpi
- });
- },
-
- },
- })
|