![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue3.0
龙雨LongYu12
一专注于开发得码农
展开
-
vue3+ts+axios 二次封装
axios在vue3+ts中的二次封装原创 2023-03-02 18:56:21 · 763 阅读 · 0 评论 -
vite打包vue3项目白屏报错
vite打包vue3项目白屏解决方法原创 2023-02-28 21:58:20 · 3961 阅读 · 1 评论 -
Vue3 + Vite + Ts:路由 vue-router 的基本使用
Vue3以后写的路由原创 2022-07-12 09:13:04 · 1515 阅读 · 0 评论 -
Vue3 + Vite + Ts: > Network: use `--host` to expose
在 vite.config.ts 中加入下面语句:原创 2022-07-11 09:55:04 · 374 阅读 · 0 评论 -
Vue3 + VIte + Ts:any类型“any”的参数不能赋给类型“never”的参数。
或根据实际来断言原创 2022-07-11 09:42:34 · 8608 阅读 · 0 评论 -
Vue3中使用vuex4
目录1、引入依赖:2、新建文件夹 store ,在里面新建文件 index.js3、index.js文件内容:4、在 main.js 中引入5、使用2、新建文件夹 store ,在里面新建文件 index.js4、在 main.js 中引入5、使用在 store/index.js 的 state 中添加 count: 0在任一组件文件中:加入下面代码:获取到容器 store 后 ,获取 Vuex 中的 count 的值,通过 store.state.count 来获取。原创 2022-06-16 10:03:38 · 996 阅读 · 3 评论 -
Vue3 + Vite + Ts 关于ref和v-model对应的字段的感悟
问题发现:有这么一段代码<input type="text" class="newAdress" ref="newAdress" placeholder="请输入地址" v-model="newAdress"/>ref 和 v-model 对应的字段名称都一样(前提:newAdress 的值为空(不为空也不影响))如果运行后会发现,输入框的内容显示变成:[object HTMLInputElement]浏览器打印字段newAdress .原创 2022-04-26 09:08:55 · 2286 阅读 · 2 评论 -
Vue3 + Vite + Ts 报错:Property ‘ ‘ does not exist on type ‘never‘
报错代码显示:src/views/Classfy/index.vue:13:20 - error TS2339: Property 'name' does not exist on type 'never'.13 <p>{{ item.name }}</p> ~~~~src/views/Classfy/index.vue:14:32 - error TS2339: Property 'icon' does原创 2022-04-24 11:16:35 · 12890 阅读 · 2 评论 -
Vue3 + VIte + Ts 实现自定义监控图片加载失败/报错处理指令
新建一个放自定义指令的文件夹代码:export const directive_onerror = function (app:any) { // 图片指令检测图片加载 app.directive('onerror', { mounted: (el:any, binding:any) => { let img = new URL('../assets/img/0.png', import.meta.url).href el.on原创 2022-04-28 09:51:35 · 887 阅读 · 0 评论 -
Vue3 + Vite + Ts 获取dom(通过ref)
元素上ref和 Vue2 一样: <div class="classfy_cell flex j-a a-c" ref="classfy">获取dom<script setup lang="ts"> import { getCurrentInstance, onMounted } from "vue"; // 引入全局 let refs = null; onMounted(() => { let { $refs } =原创 2022-04-22 14:05:27 · 2962 阅读 · 1 评论 -
自定义检测图片加载失败指令
Vue.directive('onerror', { // 监听图片加载,加载失败替换图 inserted: function (el) { el.setAttribute('onerror', `this.src="${require('./assets/images/0.png') }"`) }})说明:1、onerror是指令标识,使用时在标签中直接加入 v-onerror 就可以2、./assets/images/0.png 是图片存放地址3、指令如果很多的情.原创 2022-04-16 14:59:32 · 872 阅读 · 0 评论 -
分享一下:vue3.0在VScode的模板格式
这里有三种格式:第一种:vsc:是Vue2的模板第二种:v3:是vue3+webpack版的模板第三种:vi:是Vue3+vite的模板{ "Print to console": { "prefix": "vsc", "body": [ "<template>", " <div></div>", "</template>", "", "<script>", " expor...原创 2022-04-16 12:12:41 · 2562 阅读 · 0 评论 -
记一次Vue3的数据响应式学习
function reactive(data) { return new Proxy(data, { // 读取属性是调用 get(target, propName) { console.log('我正在被嗲用', target, propName) return Reflect.get(target, propName) }, // 修改属性或添加新的属性时调用 set(target, propName,...原创 2022-04-15 15:38:07 · 696 阅读 · 0 评论