摘要:provide inject <!-- father --> import Store from './store.js' data() { const store = new Store(this) return { store, holdLoading: false, addLoading: f
阅读全文
摘要:// 退出页面前将data中不为空的值到存到sessionstorage中,在进入页面时判断本地是否有当前页面name,有则赋值无则正常刷新 // 存store也可 beforeRouteLeave(to, form, next) { console.log(this) let a = [], b
阅读全文
摘要:<div class="logback" :style="{backgroundImage:'url('+imgUrl2+'),url('+imgUrl+')'}"> data() { return { imgUrl:require("@/assets/img/back1.png"), imgUrl
阅读全文
摘要:<div class="tree"> <ul class="treeul"> <li> <div class="dv">总公司</div> <ul> <li> <div class="dv">软件开发部</div> <ul> <li> <div class="dv">一期研发</div> </li>
阅读全文
摘要:Vue更新问题 不会触发 数组 通过数组下标为数组赋值 n1(){ this.list[0]= "用索引直接设置一个项" console.log(this.list) }, 数组改变,视图不变 改变数组长度 n2(){ this.list.length =1 console.log(this.lis
阅读全文
摘要:在线文字转语音 说不上来有点傻气的功能 首先要用到百度翻译语音那个接口http://tts.baidu.com/text2audio, 参数lan语言,lan:语言,ie:编码,spd:语速(1-9),text:要朗读的内容 有没有男声女声12的我忘了 ....我好像写过这篇啊 这个要用到audio
阅读全文
摘要:整一下swiper组件 几乎每一次用swiper都会有一些问题,就很烦 npm i swiper vue-awesome-swiper -S <div class="wrapper"> <Swiper v-if="swiper1.swiperList.length>1" ref="mySwiper"
阅读全文
摘要:video 标签自动播放 常理来说autoplay就可以解决,但目前遇到的问题是视频很大等就绪不行 如果使用的是autoplay 或者perload视频会一直停留在最开始的一帧 加上controls手动点击才可以播放,其间我看到说从08年开始怕吓到用户不允许打开页面就播放音频 这个问题纠结了我两个小
阅读全文
摘要:1.mine.js Vue.config.productionTip = false Vue.prototype.playAudio1 = function(audio){ let buttonAudio = document.getElementById('eventAudio'); button
阅读全文
摘要:Cannot find module '@vue/cli-shared-utils' 试了两种解决方法 npm update 删除 node_moduls npm install 第一种没有,第二个解决了
阅读全文
摘要:vue项目打包app vue -V → @vue/cli 4.2.3 HBuilder vue 配置文件 vue.config.js module.exports = { publicPath:'./' } 打包 npm run build HBuilder 步骤 新建一个项目 5+app 将里面除
阅读全文
摘要:路由守卫:路由拦截。(路由钩子(函数)) 生命周期:new Vue 全局守卫: beforeEach:全局前置守卫 afterEach:全局后置守卫 beforeResolve:全局解析守卫。 组件内部守卫: beforeRouteEnter:进入路由之前执行 beforeRouteUpdate:当
阅读全文
摘要:vuex:可以实现数据(data,methods(行为))的共享。是一个集中式的管理工具。 state:存储状态 mutations:函数,同步操作。更改状态。 通过该函数更改数据状态是唯一的正途。 getters计算属性 mutations模块化。 actions:异步,通过它来调用数据(接口)。
阅读全文
摘要:1、父子(向下)传值:通过属性 // 1、传递的属性不能出现大写。需要用-分割。大写转为小写 // 2、从父级接收过来的数据是不允许直接修改。 // 3、接收过来的属性名,不允许与当前组件的数据名(data属性名)相同 <body> <div id="root"> <input type="butt
阅读全文
摘要:<component v-bind:is="组件的名字"></component> 可以用keep-alive组件实例能够被在它们第一次被创建的时候缓存下来 <keep-alive> <component v-bind:is="组件的名字"></component> </keep-alive> ac
阅读全文
摘要:// 全局自定义指令 `v-one` Vue.directive('one', { inserted: function (el) { // 聚焦元素 el.focus() } }) directives: {//定义局部 // 指令的定义 red(el) { el.style.background
阅读全文
摘要:v-bind:单向绑定命令 可以绑定样式,v-bind:style="{k:v,k2,v2...}" v-bind:class ="{'类1':boolean或表达式,’2‘:...}" v-on:绑定事件监听器。 v-on:事件 = “事件处理函数” 事件对象 $event 修饰符 self 只有
阅读全文