|
@@ -5,17 +5,23 @@
|
|
|
<el-button @click="routerToLink('/b')">路由跳转到{{state.val}}</el-button><br/>
|
|
|
<el-button @click="windowToLink('/b')">window打开{{state.val}}</el-button><br/>
|
|
|
<el-button @click="locationToLink('/b')">重定向到{{state.val}}</el-button><br/>
|
|
|
+ <div style="width: 200px;height: 100px;" v-loading="state.loadingCode">
|
|
|
+ <img style="width: 100%;height: 100%;" class="__hover" :src="state.codeBase64" @click="getCode"/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import {getCurrentInstance, reactive} from "vue";
|
|
|
+import {getCurrentInstance, onMounted, reactive} from "vue";
|
|
|
import {useRouter} from "vue-router";
|
|
|
+import {captcha} from "@/api/modules/manage/user";
|
|
|
|
|
|
const router = useRouter()
|
|
|
const {proxy} = getCurrentInstance()
|
|
|
const state: any = reactive({
|
|
|
- val: ''
|
|
|
+ codeBase64: '',
|
|
|
+ loadingCode: false,
|
|
|
+ val: '',
|
|
|
})
|
|
|
const routerToLink = (url) => {
|
|
|
router.push(url)
|
|
@@ -27,6 +33,16 @@ const locationToLink = (url) => {
|
|
|
window.location.replace(url);
|
|
|
|
|
|
}
|
|
|
+const getCode = () => {
|
|
|
+ state.loadingCode = true
|
|
|
+ captcha().then(res => {
|
|
|
+ state.codeBase64 = res.data.captcherImg
|
|
|
+ state.loadingCode = false
|
|
|
+ })
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ getCode()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|