随笔分类 - vue2.x
摘要:// 1.设置v-throttle自定义指令 Vue.directive('throttle', { bind: (el, binding) => { let throttleTime = binding.value; // 防抖时间 if (!throttleTime) { // 用户若不设置防抖
阅读全文
摘要://添加.replace(/=+$/,'') replace(/[\r\n]/g,"")为了解决由于base64图片补码的问题导致的 this.$nextTick(()=>{ let urlType = '',base64code = '' if(type.toUpperCase() 'PDF'){
阅读全文
摘要:<el-image style="width: 300px; height: 150px" :src="url" :preview-src-list="srcList"> </el-image> this.url='data:image/png;base64,' + row.PAGE_IMG 其他格
阅读全文
摘要:<template> <div class="box" :style="styleVar"> </div> </template> <script> export default { props: { height: { type: Number, default: 54, }, }, comput
阅读全文
摘要:在CSS3中,我们可以使用transform属性的scale()方法来实现元素的缩放效果。缩放,指的是“缩小”和“放大”的意思。 transform: scaleX(x); / 沿x轴方向缩放/ transform: scaleY(y); / 沿y轴方向缩放/ transform: scale();
阅读全文
摘要:(28条消息) vue + css-vars-ponyfill 实现动态换肤_MrWangJB的博客-CSDN博客
阅读全文
摘要:mounted() { window.addEventListener('beforeunload', e => this.beforeunloadHandler(e)) //监听页面刷新触发事件 }, methods(){ beforeunloadHandler(e) { //根据事件进行操作进行
阅读全文
摘要:data() { return { params: { a: 1, b: 2, c: 3, d: 4 }, }; }, watch: { params: { deep: true, handler() { this.getList; }, }, } 但是如果我只想要a,b改变时重新请求,c,d改变时
阅读全文
摘要:// 创建一个隐藏的 a 标签 const a = document.createElement('a'); a.href = url; // 从 URL 中提取文件名 a.download = url.substring(url.lastIndexOf('/') + 1); a.style.dis
阅读全文
摘要:export default { name: 'page-index', data(){ return{ windowWidth: document.documentElement.clientWidth, //实时屏幕宽度 windowHeight: document.documentElemen
阅读全文
摘要:在基于vue项目开发的时候遇到一个小需求,由于项目部署环境的变更,导致前端工程中一些全局配置需要经常修改,而之前每次变更都需要重新打包发布,耗时太长操作也麻烦,于是参考网上的一些解决方案在项目中增加了一个 globalConfig.js 全局配置文件,支持打包完成后修改该文件中对应配置项刷新浏览器即
阅读全文
摘要:<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tab-pane v-for="item in elTabPaneList" :key="item.name" :name="item.name" :label="item.lab
阅读全文
摘要:1,创建PagInation.vue组件 2,index.js中引用PagInation.vue import PagInation from './PagInation.vue' 3,// 添加install方法 PagInation.install = Vue => { Vue.componen
阅读全文
摘要:指令: Vue 自定义指令有全局注册和局部注册两种方式。先来看看注册全局指令的方式,通过 Vue.directive( id, [definition] ) 方式注册全局指令。然后在入口文件中进行 Vue.use() 调用。 批量注册指令,新建 directives/index.js 文件 impo
阅读全文
摘要:一、安装lib-flexible npm i lib-flexible -D 二、在main.js中引入 import 'lib-flexible/flexible' 三、在index.html文件中设置meta标签: <meta name='viewport' content='width=dev
阅读全文
摘要:componentWillReceiveProps 挂载组件第一次不会调用这个组件,即组件将要接收新的props信息调用
阅读全文
摘要:一、$router $router是一个全局路由对象,是new Router的实例,先上console... 从console的结果看起来,在页面上拿到的$router对象正是new VueRouter所创建router对象。 进一步往里看,路由类上的一些方法就是眼熟的beforeEach、push
阅读全文
摘要:配置开发环境 "scripts": { "serve": "vue-cli-service serve --mode development", "serve:test": "vue-cli-service serve --mode test", "serve:pre": "vue-cli-serv
阅读全文
摘要:├─ src //主文件 │ ├─ api //接口文件夹 | | |- config.js //后端接口地址的配置,将测试、开发、生产环境分开 | | └─ user.js //接口文件,配置了token请求头,具体接口根据需求修改 │ ├─ assets //资源文件 │ ├─ componen
阅读全文

浙公网安备 33010602011771号