
vue
倾听雨落~
主要记录自己遇到的问题,以及经常用到的东西,方便自己回顾,也提供给大家参考。
展开
-
vue element-table分页回显选中与再次更改保留状态,前端手动过滤多条件查询
element分页table回显与更改原创 2022-11-04 11:02:10 · 814 阅读 · 1 评论 -
获取日期 年月日 时分秒
获取日期原创 2022-07-13 16:30:32 · 272 阅读 · 0 评论 -
普通数组转树形数组
普通数组转树形数组原创 2022-07-13 16:27:00 · 138 阅读 · 0 评论 -
vue 抽离出公共的js文件
目录结构:api>>indiex.ts如下export * from './common'export * from './site-survey'export * from './engine-progress'export * from './project'其余内部文件里面ts为:import { getApi, postApi } from '@/composables/useApi'export const getDetail = async ({ id, nod原创 2022-05-11 16:26:57 · 1360 阅读 · 0 评论 -
vue3学习
原创 2022-03-01 15:10:29 · 130 阅读 · 0 评论 -
vuerouter 404配置
router文件下面的index.js:原创 2022-02-16 16:10:24 · 656 阅读 · 0 评论 -
vue插槽详解
作用:父组件向子组件传递内容,slot更像是一个出口类型:默认插槽 具名插槽 作用域插槽1.父组件向子组件传递内容index.vue父组件如下:: <children> <p>我是传递的内容</p> </children >children.vue:子组件接收 如下:: <template> <div> <h1>{{msg}}</h1> <slot>&原创 2022-01-26 10:07:48 · 1710 阅读 · 0 评论 -
vue引入高德地图,逆地址解析,点标记
##再index.html中引入 <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=你申请的key值&plugin=AMap.MouseTool&plugin=AMap.Geocoder""></script> ##vue.config.js文件内:module.exports = { configureWebpack: (config) =原创 2021-12-16 14:54:25 · 1250 阅读 · 0 评论 -
es6扩展运算符(...)
对象的扩展运算符let bar={a:1,b:2}let baz={...bar}上述方法实际等价于:let bar={a:1,b:2}let baz=Object.assign({},bar)Object.assign方法用于对象的合并,将源对象(source)的所有可枚举属性,复制到目标对象(target)。Object.assign方法的第一个参数是目标对象,后面的参数都是源对象。(如果目标对象与源对象有同名属性,或多个源对象有同名属性,则后面的属性会覆盖前面的属性)。同样,如果转载 2021-12-08 15:37:42 · 151 阅读 · 0 评论 -
查询数组重复项的下标和内容
searchKeys(arr) { var str = ""; var list = []; for (var i = 0; i < arr.length; i++) { var hasRead = false; for (var k = 0; k < list.length; k++) { if (list[k] == arr[i]) { hasRead = true; ...原创 2021-09-03 09:07:51 · 695 阅读 · 0 评论 -
普通数组转树形数组
/** * 普通数组转树形数组 * @param {Array} data 需要转化的数组 * @param {String} topid 顶级的id值,一般为null 或'' * @param {String} pidKey 父节点的key值 * @param {String} idKey 子节点的key值 */export function arrayToTree(data, topid, pidKey, idKey) { let res = []; let pId = pidKe原创 2021-08-17 08:22:20 · 224 阅读 · 0 评论 -
具名插槽slot
element-UI中card卡片的使用:示例:可以通过template定义slot名称传入对应的dom结构原创 2021-08-06 17:06:15 · 159 阅读 · 0 评论 -
vue 多页应用
1.首先在src下面创建pages文件夹,里面新建page1和page2文件夹,page1和page2内新建对应的page1.vue,page1.jspage1.jsimport Vue from 'vue'import App from './page1.vue'// import router from './router'// import store from './store'Vue.config.productionTip = falsenew Vue({ // rout原创 2021-08-05 08:16:36 · 488 阅读 · 0 评论 -
安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org原创 2021-07-29 21:30:23 · 175 阅读 · 0 评论 -
vue中常用的数组方法
Vue中常用的数组方法.filter()、.map()、.forEach()、.find()、.findIndex()、.some()、.every().filter().map().forEach().find().findIndex().some().every().filter() filter() 方法创建一个新的数组,新数组中的元素是通过检查指定数组中符合条件的所有元素。 是否改变原数组:否 是否对空数组进行检测:否 语法: const arr= [32, 33转载 2021-07-28 14:58:25 · 4420 阅读 · 1 评论 -
vue定义时间过滤器
main.js文件import Moment from 'moment'Vue.filter('formatDate', function(value) { return Moment(value).format('YYYY-MM-DD HH:mm:ss')})vue使用<span>{{timer|formateDate}}</span>原创 2021-07-27 15:05:14 · 156 阅读 · 0 评论 -
vue使用bus兄弟组件中的传值
新建bus.jsimport Vue from 'vue';// 使用 Event Busconst bus = new Vue();export default bus;main.js中引入bus.jsimport bus from '../../utils/bus'Vue.prototype.$bus=bus;a.vue页面使用 this.$bus.$emit('updateOrders')//触发b.vue页面使用 this.$bus.$on('updateOrder原创 2021-07-27 15:01:25 · 179 阅读 · 0 评论 -
定义路由文件,按需加载
router文件新建router.js index.jsindex.js如下 import Vue from 'vue' import VueRouter from 'vue-router' import {router1,router2} from './routes' Vue.use(VueRouter) export const personCenterRouter = new VueRouter({ routes:router1 }) export const pers原创 2021-07-23 16:48:34 · 129 阅读 · 0 评论 -
获取当前时间封装
export function getTimeObj(sj){ var now = new Date(sj); var year=now.getFullYear(); var month=now.getMonth()+1; var date=now.getDate(); var hour=now.getHours(); var minute=now.getMinutes(); var second=now.getSeconds();原创 2021-07-23 16:29:10 · 168 阅读 · 0 评论 -
vue动态设置每个li的样式
页面: <i :style="{color: getColor(item.status)}" ></i>数据:data(){ return{ colors: { complated: '#268cf0', danger: '#FEAA00', delay: '#FD4443', undo: '#E4E9EF' },}}方法:methods: getColor(原创 2021-07-23 16:22:48 · 952 阅读 · 0 评论 -
export default和export的区别
export default一个js文件只能有一个引用方式:import sevice from seviceexport在js文件可以有多个引用方式:import {getUser,getPro} from project原创 2021-07-23 16:17:11 · 75 阅读 · 0 评论 -
promise封装axios请求
封装一个axios新建文件serve.jsimport axios from 'axios'import qs from 'qs'const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: { Authorization:'', Content-Type:'application/x-www-form-urlencoded' }});原创 2021-07-23 15:57:35 · 961 阅读 · 0 评论 -
vue 普通input监听回车事件
vue 普通input监听回车事件<input @keyup.enter="submit">原创 2021-07-23 14:36:15 · 1746 阅读 · 0 评论 -
vuex中 this.$store.dispatch() 与 this.$store.commit()方法的区别
this.$store.dispatch() 与 this.$store.commit()方法的区别总的来说他们只是存取方式的不同,两个方法都是传值给vuex的mutation改变statethis.$store.dispatch() :含有异步操作,例如向后台提交数据,写法:this.$store.dispatch(‘action方法名’,值)this.$store.commit():同步操作,,写法:this.$store.commit(‘mutations方法名’,值)commit: 同步操作转载 2021-06-16 15:23:30 · 493 阅读 · 0 评论 -
vue 水位球使用
第一步安装npm install echartsLiquidfill --save第二步引入对应的vue文件:import echartsLiquidfill from 'echarts-liquidfill'<template> <div id='waveEchart' style="width:200px;height:200px;"></div></template><script>import echartsLiquidf原创 2021-03-05 17:28:59 · 1098 阅读 · 1 评论 -
vue 倒计时效果,两个日期差计算
<template> <div style=""> <div> <p class="p1" v-if="chkValue!='0-0'">投产倒计时</p> </div> <ul class="ul1" v-if="chkValue!='0-0'"> <li> <span class="count"> <im原创 2021-03-05 17:21:16 · 869 阅读 · 0 评论 -
vue 获取当前时间
<template> <div>{{nowDate}}</div></template><script>export default {data() { return { nowDate: "", // 当前日期 }; }, mounted() { this.currentTime(); },methods: { currentTime() { setInterval(th原创 2021-03-05 17:09:10 · 4291 阅读 · 0 评论 -
vue实现无限旋转效果
<template> <div> <i :class="{'rotate360':showAnimate}" @animationend="reset" class="icon-iconfontshuaxin"></i> </div></template><script>export default { data() { return { showAnimate:原创 2021-02-25 09:50:34 · 2916 阅读 · 1 评论 -
object标签上悬浮div标签,可拖拽,播放rtsp视频
object上方悬浮div并实现拖拽,云台控制等操作<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=10"/> <meta name="viewport" content="width=device-width,initial-scale=1"> <title&g原创 2020-06-09 16:41:04 · 858 阅读 · 3 评论 -
vue播放rtsp视频
注意:1.在static目录下创建video.html2.必须安装2.2.1-win32版本的vlc插件3.vlc安装文件:链接:https://pan.baidu.com/s/1yQJ9SDh0YWw84yhXkLrMjQ提取码:zq9kcamera.vue页面: <template> <div> <a href="javascript:;" @click="yulan(record.videoUrl)">预览</a> </di原创 2020-06-09 16:25:16 · 18085 阅读 · 15 评论 -
vue 播放rtmp直播流
安装:npm install --save vue-video-player npm install --save videojs-flash<template> <section class="video-box"> <videoPlayer ref="videoPlayer" :options="videoOptions" class="vjs-custom-skin videoPlayer" :play原创 2020-05-27 11:57:21 · 3100 阅读 · 8 评论 -
vue引入echarts仪表盘样式
option = { series: [ { type: "gauge", center: ["50%", "45%"], // 仪表位置 radius: "80%", //仪表大小 startAngle: 200, //开始角度 endAngle: -20, //结束角度转载 2020-05-19 14:34:07 · 953 阅读 · 0 评论 -
vue2.0配置打包路径
config下面的index.js文件内:主要修改assetsPublicPath build: { // Template for index.html index: path.resolve(__dirname, '../dist/index.html'), // Paths assetsRoot: path.resolve(__dirname, '../d...原创 2020-04-30 10:58:59 · 1341 阅读 · 0 评论 -
axios封装及使用2
npm install axios --savenpm install ant-design-vue --save//引入组件npm install moment --save//引入日期格式**## main.js**// The Vue build version to load with the `import` command// (runtime-only or st...原创 2020-04-30 10:57:10 · 237 阅读 · 0 评论 -
axios的封装及使用1
npm install axios --save**新建http.js**import axios from 'axios';// import qs from 'qs'// import { Message } from 'element-ui';axios.defaults.timeout = 5000;axios.defaults.baseURL ='http://114.1...原创 2020-04-30 10:50:40 · 225 阅读 · 0 评论 -
vue引入antd-design-vue
1.安装:npm install ant-design-vue --save2.在main.js中 a.全部引入import ant from 'ant-design-vue'import 'ant-design-vue/dist/antd.less'Vue.use(ant)原创 2020-04-18 14:40:58 · 3071 阅读 · 0 评论 -
vue解决内存溢出问题
package.json文件:"scripts": { "dev": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --progress --config build/webpack.dev.conf.js", "start": ...原创 2019-10-18 16:51:38 · 4661 阅读 · 0 评论 -
vue点击li切换类名并且获取当前点击的值
html<!--收货地址列表--> <ul> <li v-for="(item,index) in addList" id="item.id" :class="{ active:index==current}" @click="choose_addr(index)" :key="index"> &l...原创 2019-04-16 10:59:23 · 3552 阅读 · 0 评论 -
vue 限制手机号为11位
<input placeholder="请填写准确的手机号码" "if(value.length>11)value=value.slice(0,11)" ref="tel" type="text" value="">原创 2019-04-16 11:00:13 · 4274 阅读 · 0 评论 -
vue 购物车结算
<template> <div class="Goods"> <div class="hed"></div> <div class="main"> <ul> <li v-for="(item,index) in list" :key="item.id"> ...原创 2019-04-16 11:05:27 · 461 阅读 · 0 评论