最朴素的vue3代码了

<!DOCTYPE html>
<html>
<head>
  <title>Your Vue 3 App</title>
  <!-- 引入 Vue 3 的 CDN 文件 -->
  <script src="https://unpkg.com/vue@3.2.26/dist/vue.global.js"></script>
  <!-- 引入 axios 的 CDN 文件 -->
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<!-- Vue 3 应用的根元素 -->
<div id="app">
  <!-- 表单 -->
  <form @submit.prevent="submitForm">
    <!-- 输入用户名 -->
    <label for="username">用户名:</label>
    <input type="text" id="username" v-model="username" />

    <!-- 输入密码 -->
    <label for="password">密码:</label>
    <input type="password" id="password" v-model="password" />

    <!-- 提交按钮 -->
    <button type="button" @click="submitForm">登录</button>
  </form>
</div>

<script>
  // 创建 Vue 3 应用
  const app = Vue.createApp({
    data() {
      return {
        username: '',
        password: ''
      };
    },
    methods: {
      submitForm() {
        // 构造请求参数
        const data = {
          username: this.username,
          password: this.password
        };

        // 创建带有基本URL的 Axios 实例
        const api = axios.create({
          baseURL: 'http://127.0.0.1:18885' // 你的后端API的基本URL
        });

        // 发起 POST 请求
        api.post('/huarun/test',data)
        .then(response => {
          // 请求成功处理
          console.log(response.data);
        })
        .catch(error => {
          // 请求失败处理
          console.error(error);
        });

        // 发起 GET 请求
        // api.get('/huarun/test',{
        //   params: {
        //     username: this.username,
        //     password: this.password
        //   }
        // })
        // .then(response => {
        //   // 请求成功处理
        //   console.log(response.data);
        // })
        // .catch(error => {
        //   // 请求失败处理
        //   console.error(error);
        // });

        
      }
    }
  });

  // 挂载 Vue 3 应用到根元素
  app.mount('#app');
</script>
</body>
</html>

最朴素的vue3代码了

### Vue3 Button 组件属性详解 在 Vue 3 中,`Button` 组件的设计旨在提供高度的灵活性和功能性。以下是 `Button` 组件的一些重要属性及其说明: #### 基本属性 - **type**: 定义按钮的样式类型,常见的有默认(default)、主要(primary)、成功(success)、警告(warning) 和 危险(danger)[^1]。 | 类型 | 描述 | | -------- | ------------------ | | default | 默认样式 | | primary | 主要操作按钮 | | success | 成功状态按钮 | | warning | 警告提示按钮 | | danger | 错误或危险动作按钮 | - **size**: 控制按钮大小,通常分为大(large)、中(medium,默认)、小(small),以及更小巧(mini)。 ```html <v-button type="primary" size="large">Large</v-button> ``` #### 功能增强属性 - **disabled**: 设置布尔值以禁用按钮交互能力。 ```html <v-button :disabled="true">Disabled</v-button> ``` - **loading**: 显示加载中的效果,适用于提交表单或其他耗时操作期间防止重复点击。 ```html <v-button loading>Loading...</v-button> ``` - **plain**: 创建朴素风格的按钮,背景透明仅保留边框颜色变化。 ```html <v-button plain>Plain Style</v-button> ``` #### 高级配置选项 - **icon**: 可选参数用于指定图标名称,在按钮内部展示相应图标的SVG路径数据。 ```html <v-button icon="search"></v-button> ``` - **round/circle**: 圆角(round) 或圆形(circle) 形状设置,使按钮外观更加圆润。 ```html <v-button round>Rounded Button</v-button> <v-button circle><Icon /></v-button> ``` 这些属性共同作用使得开发者可以根据实际应用场景定制不同样式的按钮控件,满足多样化的界面设计需求。 ```html <!-- 示例代码 --> <v-button type="success" size="small" @click="handleClick" :loading="isLoading" plain round icon="checkmark"> Submit Query </v-button> ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值