vue
犯困Baby
这个作者很懒,什么都没留下…
展开
-
vue项目解决报错路由重复;Avoided redundant navigation to current location: “/home“.
在router文件夹内的index.js文件内加入以下内容//加入的内容const originalPush = VueRouter.prototype.pushVueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err)}import Vue from 'vue'import VueRouter from 'vue-rou原创 2021-09-14 11:18:56 · 247 阅读 · 0 评论 -
vue js数据 保留4位 或者 几位
vue js数据 保留4位 或者 几位四舍五入根据实际情况进行修改变量let bu = 1.666666666this.bu = bu.toFixed(4)//保留几位修改为几console.log(this.bu)//值为1.6667直接截取不四舍五入根据实际情况进行修改let bu = 1.6666666666this.bu = Math.floor(bu * 100) / 100 console.log(this.bu)//值为1.66this.dev = Ma原创 2021-09-13 17:03:22 · 568 阅读 · 0 评论 -
vue中使用Vant的Dialog 弹出框点击确认,复制文本
Vant的Dialog 弹出框中使用事件confirm事件绑定Vant的Dialog文档confirm: { this.$copyText(this.t_son).then(function (e) { console.log('复制成功',e.text) }, function (e) { console.log(err) console.log('不能复制,复制失败')原创 2021-08-23 16:16:50 · 1812 阅读 · 4 评论 -
npm run build 打包部署
一.(打包命令)要在修改 package.json 中的 scripts 属性,添加 build,二.根目录下创建 ***vue.config.JS***文件,添加如下配置module.exports = { publicPath: process.env.NODE_ENV === 'production' ? './' : '/'}在运行npm run build进行打包完成后直接运行dist文件夹内的index.HTML文件查看....原创 2021-08-18 09:38:17 · 3453 阅读 · 0 评论 -
请求后端地址返回图片,后缀不同,进行处理
**通过匹配不同后缀名,进行判断,使用时直接调用getImgPathexport const getImgPath = { methods: { //传递过来的图片地址需要处理后才能正常使用 getImgPath(path) { let suffix; if (!path) { return '//elm.cangdu.org/img/default.jpg' } if (path.indexOf('jpeg') !== -1) { suffix = '原创 2021-05-31 17:24:59 · 276 阅读 · 0 评论