09 2021 档案

摘要:provide 可以传入两个参数: name: 提供的属性名称 value: 提供的属性值 inject 可以传入两个参数 要 inject 的 property 的name 默认值 阅读全文
posted @ 2021-09-30 15:57 熊大大001(前端开发) 阅读(349) 评论(0) 推荐(0)
摘要:在 vue2 中可以通过 watch 选项来侦听 data、props的数据变化,当数据变化时执行某一些操作。在 Composition API 中我们可以使用 watchEffect、watch 来完成响应式数据的侦听 watchEffect 用于自动收集响应式数据的依赖; watch 需要手动指 阅读全文
posted @ 2021-09-30 15:55 熊大大001(前端开发) 阅读(321) 评论(0) 推荐(0)
摘要:<script> import { onBeforeMount, onMounted, onUpdated, onUnmounted } from "vue"; export default { setup() { onBeforeMount(() => { console.log("onBefor 阅读全文
posted @ 2021-09-30 15:55 熊大大001(前端开发) 阅读(1000) 评论(0) 推荐(0)
摘要:<template> <div> <ul> <li v-for="(item, index) in stuList" :key="index"> <span>{{ item.name }}</span> —— <span>{{ item.score }}</span> </li> </ul> <di 阅读全文
posted @ 2021-09-30 15:50 熊大大001(前端开发) 阅读(681) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-09-30 15:50 熊大大001(前端开发) 阅读(640) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-09-30 15:49 熊大大001(前端开发) 阅读(229) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-09-30 15:48 熊大大001(前端开发) 阅读(235) 评论(0) 推荐(0)
摘要:ue3转变 从 vue3 开始,由 setup 替代 vue2 data、methods、watch等 ,这样可以避免一个功能的代码逻辑拆分到各个属性中而变得难以阅读 vue3 setup 的这种写法可以更好的使用 TypeScript注意事项: setup 函数里面不可以使用 this, 因为se 阅读全文
posted @ 2021-09-30 15:47 熊大大001(前端开发) 阅读(224) 评论(0) 推荐(0)
摘要:Ref <template> <h1>{{name}}</h1> <h1>{{age}}</h1> <button @click="sayName">按钮</button> </template> <script lang="ts"> import {ref,computed} from 'vue' 阅读全文
posted @ 2021-09-30 15:03 熊大大001(前端开发) 阅读(126) 评论(0) 推荐(0)
摘要:import {onMounted, ref} from 'vue' export default function useMouse() { let x = ref(0) let y = ref(0) onMounted(() => { window.addEventListener('mouse 阅读全文
posted @ 2021-09-30 14:58 熊大大001(前端开发) 阅读(2322) 评论(0) 推荐(0)
摘要:// useCount.js import {ref,reactive,computed} from 'vue' export default function useCount() { // 简单数据定义及使用 let count = ref(0) function addCount() { co 阅读全文
posted @ 2021-09-30 14:54 熊大大001(前端开发) 阅读(92) 评论(0) 推荐(0)
摘要:一、reactive reactive 用于为对象添加响应式状态。接收一个js对象作为参数,返回一个具有响应式状态的副本。 获取数据值的时候直接获取,不需要加.value 参数只能传入对象类型 import { reactive } from 'vue' // 响应式状态 const state = 阅读全文
posted @ 2021-09-30 14:41 熊大大001(前端开发) 阅读(413) 评论(0) 推荐(0)
摘要:// watch: { // 'form.timeScopes': function (val) { // console.log("进入吗?"); // console.log(val); // } // }, // computed: { // lossMinutes: function () 阅读全文
posted @ 2021-09-09 11:27 熊大大001(前端开发) 阅读(35) 评论(0) 推荐(0)
摘要:<div style="width:730px;"> <input type="text" id="search_name7" name="search_name" value="" style="display:none;"> <div style="height: 345px;margin-to 阅读全文
posted @ 2021-09-08 10:28 熊大大001(前端开发) 阅读(217) 评论(0) 推荐(0)
摘要:<template> <view v-for="(item, index) in Items" :key="index"> <image :src="item.imgUrl" mode="aspectFill" @error="error(index)"></image> </view> </tem 阅读全文
posted @ 2021-09-07 11:38 熊大大001(前端开发) 阅读(593) 评论(0) 推荐(0)