- 博客(27)
- 收藏
- 关注
原创 解决 .prettierrc.cjs文件中报错 ‘module‘ is not defined.eslintno-undef
在eslint.config.js文件中 配置 env: { browser: true, es2020: true }即可。
2024-12-22 11:15:53
189
原创 vue错误NavigationDuplicated: Avoided redundant navigation to current location:
避免了到当前位置的冗余导航:解决办法就是在router下面的index.js加上一段代码const originalPush = VueRouter.prototype.push;VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch((err) => err);};加上之后错误就消失了,如果对你有用,记得点赞。...
2021-07-19 14:18:46
296
原创 关于git。
第一步新建一个文件夹 然后git init (初始化文件夹使文件夹可管理)第二步git status 查看状态第三步git add .git commit -m '要提交的信息'git remote add origin https://github.com/mahao9/vue_practice.git ‘远程在这个地址上面创建源’git push -u origin main如果抛出这个错误git add README.md如果抛出这个错误...
2021-07-14 23:55:14
133
原创 关于el-table不能及时更新数据的问题
闲来无事写一写父子组件之间通讯的demo,遇到了好多坑,真的是菜。好,现在就记录下来。demo大概是上面的样子 点击新增个人信息 弹出子组件然后输入表单信息添加到父组件内,并可以在父组件上点击编辑按钮 弹出子组件回显要编辑的表单信息。遇到的最坑的地方就是el-table 不能及时回显数据(但是数据已经更新)。1.父组件控制子组件的显示<add-list :title="title" :dialogVisible.sync="isShowInfo...
2021-07-13 17:09:51
4232
2
原创 关于for和forEach
1.今天写代码遇到一个问题困扰了我半天时间 代码如下this.personInfoTableData.forEach((item, index) => { if (item.id === copyObj.id) { this.personInfoTableData[index] = copyObj; return; } }); this.personInfoTableData.push(copyObj
2021-07-13 16:46:53
117
原创 el-select如何获取label
<el-form-item label-width="0" prop="field101"> <el-select v-model="selectModel.field101" placeholder="请选择下拉选择" clearable :style="{ width: '100%' }" .
2021-07-12 14:16:52
653
原创 使用vuex存储状态页面刷新后数据丢失怎么处理
vue是单页面应用,页面切换都是在一个页面跳转路由,因此sessionStorage较为合适。(sessionStorage的生命周期是在仅在当前会话下有效)所以应该在页面加载的时候将store里面的状态传入进sessionStorage里面在app.vue内假如以下代码created() { // 在页面加载时读取sessionStorage里的状态信息,还原store if (sessionStorage.getItem('store'))
2021-05-10 16:18:50
194
原创 2021-03-27
1.如果一个 变量根本没有被声明,使用typeof反而不会报错。typeof undeclared_variable //"undefined"2.在没有let之前,typeof是一个百分百安全的运算符,永远不会报错。3.在代码块内,使用let命令声明了一个变量,在声明之前该变量都是不可用的,这在语法上称为“暂时性死区”。...
2021-03-27 08:02:07
84
原创 使用vue-cli创建的vue项目,用vsCode启动后,再使用vue ui 打开项目仪表盘就会报错,错误信息如下截图所示。
解决办法:如图所示 以管理员身份打开PowerShell 窗口。运行set-ExecutionPolicy RemoteSigned 选择A即可之后再到vsCode终端里面执行 vue ui 就可以启动项目仪表盘了 。
2021-03-26 20:09:35
1040
原创 Mac安装nodejs
1.首先安装homebrew/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"查看安装是否成功 brew --v2. 安装nodebrew install node坚持node npm 是否安装完成node -vnpm -v3.安装淘宝镜像npm install -g cnpm --registry=https://r...
2021-03-26 11:48:57
219
原创 2021-03-15
我们前端在对后台接口的时候,往往会发现接口中的某个字段没有数据,回显的事null 或者 '' 再或者是 undefined,比如我们获取后台借口头像的地址imgURl ,var imgURL;if(imgURL!=null && typeof(imgURL)!= undefined&&imgURL !=''){ //imgURL有内容才执行的代码 }此时我们就可以换另外一种写法,if (!!imgURL) { //imgURL 有内容才执行的代
2021-03-15 21:53:40
87
原创 vue v-for循环内的数据按钮点击增减className
<template> <div> <ul> <li v-for="(item, index) in cureList" :key="item.id"> <div class="special-cure" @click="toggleActive(index)" :class="{ active: item.isActive }"> .
2020-06-20 09:50:03
648
原创 vue 点击添加class,其他元素移除class(循环数组)
<div class="admin-main-nav"> <ul id="mainNav"> <li v-for="(item, index) in items" :key="item.id" :class="{ active: current == index }" @click="selectNav(index)" > &l.
2020-05-28 17:44:17
1895
1
原创 vue非父子组件通信
<div id="app"> <div v-if="this.message.length">{{message}}</div> <div id="" v-else><span>数据为空</span></div> <component-a></c...
2020-04-27 15:48:13
250
原创 css使用text-align: justify;解决两个
.publish-the-line .publish-prefix{ width: 52px;}.publish-prefix span{ width: 100%; display: inline-block; text-align: justify; height: 15px; overflow: hidden; letter-spacing:1px;}.publis...
2020-04-08 15:35:38
506
原创 小程序金额显示隐藏
要求上面的金额显示隐藏。wxml:<view class="month-spendingBox"> <view class="month-spendingInwrap" bindtap="eyeChange"> <text>本月支出 (元)</text> <view class="spending-...
2020-04-07 16:02:52
872
原创 小程序点击按钮显示隐藏
wxml:<view > <button class="{{showView?'show':'hide'}}" bindtap="change">{{showView?'隐藏':'显示'}}</button> <button class="{{showView?'hide':'show'}}" bindtap="change">...
2020-04-07 15:05:50
5436
1
原创 http service 测试移动端h5
首先下载安装node.js node 官网就可以 。然后npm install -g http-server 安装手机服务执行命令打开.bat 的文件
2020-03-20 13:50:59
208
原创 table表头固定,内容出滚动条。
表格固定。内容可以滚动(已截图)。 <div class="m-table-scroll "> <table class="m-table table-bordered is-fixed"> <thead> <tr> <th class="thead">标题</th>...
2019-12-26 11:33:30
527
原创 新闻列表的图片img 自适应大小铺满美观
.hui-news-list-r { width: 32%; float: right; height: 78px; line-height: 78px;}.hui-news-list-r img { width: 100%; height: 100%; object-fit: cover;}
2019-10-17 11:22:35
675
原创 关于小程序原生tabBar的使用
在app.json里面加入"tabBar": { "color": "#dddddd", "selectedColor": "#3cc51f", "borderStyle": "black", "backgroundColor": "#ffffff", "list": [ { "pagePath": "pages/index...
2019-06-18 14:40:55
1921
原创 关于swiper滑动时a标签误触,导致跳转的解决办法。(简单粗暴)
var swiper = new Swiper('.swiper-container', { on: { touchStart: function(event){ event.stopPropagation() }, }, });
2019-05-30 14:17:34
1251
原创 jquery.scrollbar模拟滚动条的使用
1.需要引入的文件<link rel="stylesheet" href="../css/jquery.scrollbar.css" /><script src="../js/jquery-1.7.2.min.js"></script><script src="../js/jquery.scrollbar.min.js"&
2018-08-23 16:52:55
2835
原创 vue.js组件的全局注册和局部注册详解
1全局注册实例(按照官网的例子下面是代码) <div id="app"> <com-btn></com-btn> <com-btn></com-btn> </div><script> Vue.component('com-btn',{
2018-08-11 14:08:34
14056
原创 vue 点击按钮加减 并设定范围超出范围不可点击
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,width=device-width"> &
2018-08-06 11:19:21
421
原创 vue2.0 tab切换,选项卡。
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
2018-08-06 10:42:13
1279
原创 为什么typeof arr 返回的是对象object
数组本身也是对象判断是否是数组和对象 用typeof 是分辨不出来的应该用Array.isArray()或者用 arr instanceof Array
2018-07-23 17:56:02
551
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人