1. <script lang="ts">
    2. import { defineComponent,onMounted,onUpdated,onUnmounted, reactive, toRefs } from 'vue'
    3. export default defineComponent({
    4. setup() {
    5. const state = reactive({
    6. n: 1
    7. })
    8. const add = () => {
    9. state.n++
    10. }
    11. onMounted(() => {
    12. fetch('/ajax/movieOnInfoList?token=&optimus_uuid=F04A6B70984011EB89DA9FC9709563EEE1FC4395B1554473B6696781D0EF2CDC&optimus_risk_level=71&optimus_code=10')
    13. .then(data=>data.json())
    14. .then(res=>{console.log(res)})
    15. .catch(error=>Promise.reject(error))
    16. })
    17. onUpdated(()=>{
    18. console.log('数据修改')
    19. })
    20. return {
    21. ...toRefs(state),
    22. add
    23. }
    24. },
    25. })
    26. </script>