<template>
  <div class="page-container">
    <div class="page-outer">
      <el-form>
        <el-form-item label="账号">
          <el-input v-model:value="form.username" placeholder="账号" />
        </el-form-item>
        <el-form-item label="密码">
          <el-input type="password" v-model:value="form.password" placeholder="密码" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" style="width: 100%" @click="submit"
            >登 录</el-button
          >
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { useStore } from "vuex";
import { defineComponent, reactive, getCurrentInstance } from "vue";
export default defineComponent({
  name: 'v-login',
  setup() {
    const { proxy } = getCurrentInstance();
    const store = useStore();
    const form = reactive({
      username: "admin",
      password: "111111",
    });
    return {
      form,
      proxy,
      store
    };
  },
  methods: {
    submit() {
      // this.proxy.$post("/user/login", this.form).then((res) => {
      //     const data = res.data;
      //     this.store.commit("setToken", data.token);
      // });
      this.$router.push('/');
    },
  },
});
</script>

<style lang="less" scoped>
.page-container {
  position: relative;
  width: 100%;
  height: 100%;
  .page-outer {
    width: 400px;
    transform: translate(170%, 280%);
  }
}
</style>