基于微信小程序的旧衣回收系统-代码

时间:2024-09-30 21:46:30
<template>  
  <div>  
    <input v-model="orderName" placeholder="请输入衣物名称" />  
    <select v-model="category">  
      <option value="clothes">衣物</option>  
      <option value="shoes">鞋子</option>  
      <!-- 更多分类选项 -->  
    </select>  
    <button @click="submitOrder">提交订单</button>  
  </div>  
</template>  
  
<script>  
export default {  
  data() {  
    return {  
      orderName: '',  
      category: 'clothes'  
    };  
  },  
  methods: {  
    submitOrder() {  
      // 假设使用axios进行HTTP请求  
      axios.post('/api/recycle', {  
        name: this.orderName,  
        category: this.category  
      }).then(response => {  
        alert('订单提交成功!');  
      }).catch(error => {  
        console.error('提交订单失败:', error);  
      });  
    }  
  }  
};  
</script>