const fs = require('fs');
const path = 'D:\\project\\zhizhu\\components\\PhotoUploadForm.vue';
const content = fs.readFileSync(path, 'utf8');
const lines = content.split('\n');

console.log('=== Lines 1300-1330 (around the issue) ===\n');
for (let i = 1299; i < 1330; i++) {
  console.log(`Line ${i + 1}: ${lines[i]}`);
}

console.log('\n=== Looking for methods: declaration ===');
for (let i = 390; i < 410; i++) {
  console.log(`Line ${i + 1}: ${lines[i]}`);
}

console.log('\n=== Checking methods object structure ===');
// 找到 methods: 的位置
let methodsStart = -1;
for (let i = 0; i < lines.length; i++) {
  if (lines[i].includes('methods:') && !lines[i].includes('onLoad') && !lines[i].includes('onShow')) {
    methodsStart = i;
    break;
  }
}
console.log('methods: starts at line', methodsStart + 1);

// 找到 methods 对象的结束（应该是 }, 后面跟着 },
let braceCount = 0;
let started = false;
for (let i = methodsStart; i < lines.length; i++) {
  const line = lines[i];
  
  if (line.includes('{')) {
    started = true;
  }
  
  if (started) {
    braceCount += (line.match(/{/g) || []).length;
    braceCount -= (line.match(/}/g) || []).length;
    
    if (braceCount === 0) {
      console.log(`Methods object might end at line ${i + 1}: ${line}`);
      console.log(`  Next line: ${lines[i + 1]}`);
      break;
    }
  }
}
