vue
袁丢丢
这个作者很懒,什么都没留下…
展开
-
van-field实现自定义图标
1.在在阿里巴巴图标库https://www.iconfont.cn/中找到需要的icon加购物车。代码中class-prefix的值和name的值拼接起来要和下图中的class名一致。3.把以下四个文件放到assets中。2.在购物车中下载代码。原创 2023-03-24 16:26:25 · 1561 阅读 · 0 评论 -
vue项目打包成.exe桌面应用
整理一下本人实现vue项目打包成桌面应用的流程一、新建文件夹,使用git下载# giteegit clone https://gitee.com/wallace5303/electron-egg.git# githubgit clone https://github.com/wallace5303/electron-egg.git二、进入到electron-eggcd electron-egg-> npm install三、把你的项目打包成dist文件,生成的dist文件把 el原创 2022-05-30 15:06:28 · 1445 阅读 · 6 评论 -
vue设置每个页面title
在main.js里添加一下代码:Vue.directive('wechat-title', { inserted: function (el,binding) { document.title = binding.value }})路由中添加metaroutes: [ { path: '/', name: 'Home', component: Home, meta:{ title:'在这里设置标题'原创 2021-06-11 11:23:43 · 87 阅读 · 0 评论 -
vue中动态拼接的html中点击方法触发
let infoWindow = “<div onClick = 'goDetail()'>查看详情</div>”methods:{ goDetail(){ console.log('xiangqing') },}连接两者:created(){ let _this = this window.goDetail=_this.goDetail;},原创 2021-03-11 10:12:50 · 503 阅读 · 3 评论 -
vue中只在页面循环显示列表中的一部分数据
开始是这样写的,但是v-if和v-for不可以同时使用,v-for的优先级更高,会遍历列表中所有数据,降低性能// 不建议使用这种方法<li class="li li1" v-for="(item,index) in searchList" :key="index" v-if="index >6"></li>使用计算属性处理需要的列表<li class="li li1" v-for="(item,index) in secondList1" :key="ind原创 2020-12-17 17:39:07 · 4844 阅读 · 0 评论 -
vue中的竖向滚动条实现方法
<template> <view> <view class="search-input-box"> <view class="search-scroll" :class="{aniamtedTop}"> <view class="search-list" v-for="(item,index) in searchList"> {{item.content}} </view> </view原创 2020-08-18 17:12:10 · 3989 阅读 · 2 评论 -
vue使用filter过滤器优化价格格式
filter中的jsmoneyFilter.js:export function toMoney(money){ if(money){ money = money.toFixed(2) }else{ money = 0; money = money.toFixed(2) } return money;}vue文件使用:// template:<p>¥{{price | moneyfilter}}</p>// script: import {toM原创 2020-08-04 13:49:22 · 535 阅读 · 1 评论 -
props传值时无法在mounted处理的解决方法
遇到的问题:父组件传值,在子组件中不能用mounted处理export default{ props:['floor1'], data(){ return { floor1_0:'', floor1_1:'', floor1_2:'', } }, mounted(){ console.log(this.floor1) //打印出的不是所传的值 this.floor1_0 = this.floor1[0]; }}因为pr原创 2020-07-29 16:46:38 · 2396 阅读 · 0 评论 -
vue中computed、watch和methods的区别和用法
vue中computed、watch和methods的区别和用法computed和watch原创 2020-07-14 15:24:51 · 524 阅读 · 0 评论