<template>
  <div class="lang-switch">
    <el-button @click="switchToZh" :type="langStore.currentLang === 'zh-CN' ? 'primary' : 'text'">中文</el-button>
    <el-button @click="switchToEn" :type="langStore.currentLang === 'en' ? 'primary' : 'text'">English</el-button>
  </div>
</template>

<script setup>
import { useLangStore } from '@/pinia/langStore'

const langStore = useLangStore()

// 切换到中文
const switchToZh = () => {
  langStore.changeLang('zh-CN')
}

// 切换到英文
const switchToEn = () => {
  langStore.changeLang('en')
}
</script>

<style scoped>
.lang-switch button {
  margin: 0 8px;
  padding: 4px 12px;
  cursor: pointer;
}
</style>