| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- // components/record-index/record-index.js
- Component({
- properties: {
- id: {
- type: String,
- value: ''
- }
- },
- data: {
- loading: true,
- error: false,
- charts: [],
- rect: {
- width: 0,
- height: 0
- }
- },
- lifetimes: {
- attached() {
- this.init();
- }
- },
- methods: {
- async init() {
- try {
- const systemInfo = wx.getSystemInfoSync();
- const rect = {
- width: systemInfo.windowWidth,
- height: 300
- };
-
- this.setData({ rect });
- await this.loadCharts();
- } catch (error) {
- console.error('Failed to initialize record-index:', error);
- this.setData({ error: true, loading: false });
- }
- },
- async loadCharts() {
- try {
- // TODO: Implement your chart data loading logic here
- // This should be similar to what you have in the page version
- this.setData({ loading: false });
- } catch (error) {
- console.error('Failed to load charts:', error);
- this.setData({ error: true, loading: false });
- }
- }
- }
- });
|