import OHeader from '@/components/o-header'
import OSticky from '@/components/o-sticky'
// import request from '@/helpers/request'
import request from 'umi-request'
import { Button } from 'vant'
import { defineComponent, ref } from 'vue'

export default defineComponent({
  name: 'test',
  setup() {
    const result = ref('')
    const onSubmit = async () => {
      const { data } = await request.get(
        'https://dev.kt.colexiu.com/edu-app/open/sysArea/queryAllProvince',
        {
          mode: 'cors'
        }
      )
      console.log(data)
      result.value = JSON.stringify(data)
    }
    return () => (
      <div>
        <OSticky>
          <OHeader title="测试接口请求" />
        </OSticky>

        <Button type="primary" onClick={onSubmit}>
          请求接口
        </Button>

        <pre style={{ fontSize: '16px', padding: '12px' }}>{result.value}</pre>
      </div>
    )
  }
})
