Commit 0c91ba88 authored by 罗超's avatar 罗超

1

parent c2d9530e
......@@ -3,8 +3,12 @@ import {
} from 'vue'
import App from './App.vue'
import Toast from "./wxcomponents/vant/toast/toast";
import Dialog from "./wxcomponents/vant/dialog/dialog";
import plugin from './utils/plugin'
let app = createApp(App)
app.provide("$toast", Toast)
app.provide("$dialog", Dialog)
app.use(plugin)
// app.config.globalProperties.$toast = Toast;//全局挂载方法
// app.component('v-MessageBox',MessageBox);//全局注册组件
app.mount()
......@@ -90,7 +90,6 @@ import {
} from "vue";
import { getStudentLeaveList, invalidReceiptInfo } from "../../api/index";
import Loadmore from "../../components/loadmore.vue";
import Dialog from "../../wxcomponents/vant/dialog/dialog";
export default {
components: {
Loadmore,
......@@ -98,6 +97,7 @@ export default {
setup() {
let userInfo = uni.getStorageSync("userInfo");
let Toast = inject("$toast");
let Dialog = inject("$dialog");
let data = reactive({
data: [],
pageState: "more",
......
......@@ -2,9 +2,11 @@
<view :style="{ 'padding-top': `${statusBarHeight}px` }">
<view style="height: 100rpx"></view>
<van-nav-bar fixed>
<van-icon name="cross" slot="left" size="30rpx" @click="back" />
<template #left>
<van-icon name="cross" size="30rpx" @click="back" />
</template>
<template #title>
<view
slot="title"
class="flex"
style="justify-content: center"
@click="start"
......@@ -23,6 +25,7 @@
ref="countdown"
/>
</view>
</template>
</van-nav-bar>
<view class="exam-con">
<Sub1 />
......
......@@ -131,6 +131,7 @@ import {
} from "vue";
import { getIndexInfo } from "../../api/index";
import { getSystemInfo, desensitization } from "../../utils/index";
import request from "../../utils/request.js";
export default {
name: "",
props: {},
......@@ -203,7 +204,6 @@ export default {
},
],
});
let methods = {
jumpPage(url) {
uni.navigateTo({
......@@ -232,6 +232,7 @@ export default {
};
onMounted(() => {
console.log(process.env);
getSystemInfo((res) => {
data.statusBarHeight = res.statusBarHeight;
});
......@@ -250,7 +251,10 @@ export default {
};
},
onLoad() {
console.log("index load");
// let { ctx } = getCurrentInstance();
// ctx.$test("首页");
// this.$test("首页");
// console.log(256, this);
uni.setNavigationBarTitle({
title: "首页",
});
......
......@@ -6,7 +6,7 @@
如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作
* // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象,------------reactive对象不能直接赋值--------------
*@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式,需用...toRef()
* 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy } = getCurrentInstance(); ctx或proxy.$挂载的方法
* 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy,refs } = getCurrentInstance(); ctx或proxy.$挂载的方法
*/
import {
ref,
......@@ -37,11 +37,19 @@ export default {
watch(name, (newVal, oldVal) => {
console.log(51, newVal);
});
//监听对象的某一项
watch(
() => msg.Account,
(val) => {
console.log(val);
}
);
// computed 计算属性 : 适合计算一个属性, 并且绑定.
// computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算
// 计算出来的结果是只读的, 所以fullName是不能被改变的
const fullName = computed(() => name.firstname + name.lastname);
// const fullName = computed(() => { return name.firstname + name.lastname});
// 高级用法: 可以修改值
const fullName2 = computed({
get: () => name.firstname + name.lastname,
......@@ -57,5 +65,15 @@ export default {
fullName2,
};
},
onLoad() {
//这里有this
let { ctx } = getCurrentInstance();
ctx.$test("首页");
this.$test("首页");
console.log(69, this);
uni.setNavigationBarTitle({
title: "首页",
});
},
};
</script>
This diff is collapsed.
*{
/* *{
font-family: PingFang SC;
box-sizing: border-box;
} */
:global(*) {
font-family: PingFang SC;
box-sizing: border-box;
}
.flex {
......
let host = 'http://192.168.20.17:8017/api'
if (process.env.NODE_ENV === "development") {
host = 'http://192.168.20.17:8017/api'
} else {
host = 'http://192.168.20.17:8017/api'
}
import Toast from '../wxcomponents/vant/toast/toast';
let token = uni.getStorageSync('userInfo').Token;
let request = (param) => {
......@@ -28,7 +33,5 @@ let request = (param) => {
}
});
})
}
export default request
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment