1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <template> <el-rate v-model="state.score" @click="scoreTest" :texts="['oops', 'disappointed', 'normal', 'good', 'great']" show-text size="large" /> <br /> {{ state.score }} </template>
<script setup> import axios from "axios"; import { reactive } from "vue";
const state = reactive({ score: 0, });
const scoreTest = () => { axios .get("/xx/elm", { params: { score: state.score, }, }) .then((respon) => { console.log(111); }) .catch((error) => { console.log(error); }); }; </script>
<style></style>
|
后台:
1 2 3 4
| @GetMapping("/elm") public void test(@RequestParam("score") int param) { System.out.println(param); }
|
即可实现评分操作, 前端部分可以是整数型数据,后台接收的数据是 int