随笔分类 -  VUE

摘要:父级调用子级 父级: <script> this.$refs.child.load(); 或 this.$refs.one.load(); </script> 子级: <Hello ref="child"/> 或 <Hello ref="one"/> 子级调用父级 : 父级一定要加事件监听 v-on 阅读全文
posted @ 2022-04-09 13:24 武卡卡 阅读(155) 评论(0) 推荐(0) 编辑
摘要:在根目录下创建 vue.config.js 文件 。 即可 vue.config.js : // vue.config.js 配置说明 //官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions // 这里只列一 阅读全文
posted @ 2022-03-12 00:49 武卡卡 阅读(2372) 评论(0) 推荐(0) 编辑
摘要:因为字符串模板不能被vue所渲染,所以这种方式行不通。 可采用组件的方式 父组件 <template> <div id="app"> <My v-for="(v,index) in commentList" :key="index" :commentId="v"/> </div> </templat 阅读全文
posted @ 2021-11-29 13:40 武卡卡 阅读(378) 评论(0) 推荐(0) 编辑
摘要:'/api': { target: 'http://localhost:8088/', //这里后台的地址模拟的;应该填写你们真实的后台接口 changOrigin: true, //允许跨域 pathRewrite: { /* 重写路径,当我们在浏览器中看到请求的地址为:http://localh 阅读全文
posted @ 2021-11-15 22:02 武卡卡 阅读(267) 评论(0) 推荐(0) 编辑
摘要:需要通过 require包裹 <template> <div> {{user.username}}: <img :src="user.avatar" class="avatar"> </div> </template> <script> export default { name: 'Persona 阅读全文
posted @ 2021-11-14 13:20 武卡卡 阅读(143) 评论(0) 推荐(0) 编辑
摘要:<div :class="{active:item.index==1}" > </div> 阅读全文
posted @ 2020-02-03 15:29 武卡卡 阅读(123) 评论(0) 推荐(0) 编辑
摘要:一,在 created中 注册 页面刷新和关闭事件 created() { window.addEventListener('beforeunload', e => this.test(e)) } 二,事件,将你的逻辑方法加进去 methods: { test(e) { console.log('刷 阅读全文
posted @ 2019-12-27 21:41 武卡卡 阅读(17928) 评论(0) 推荐(2) 编辑
摘要: 阅读全文
posted @ 2019-12-24 12:27 武卡卡 阅读(4015) 评论(0) 推荐(1) 编辑
摘要: 阅读全文
posted @ 2019-12-20 15:08 武卡卡 阅读(369) 评论(0) 推荐(1) 编辑
摘要: 阅读全文
posted @ 2019-12-20 14:41 武卡卡 阅读(2125) 评论(0) 推荐(0) 编辑
摘要:router.beforeEach((to, from, next) => { if(to.path!='/login' && localStorage.token==undefined){ next('/login') return } next() }) 阅读全文
posted @ 2019-12-19 21:18 武卡卡 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-12-16 15:10 武卡卡 阅读(4061) 评论(0) 推荐(0) 编辑
摘要:第一种,只引入单个图片,这种引入方法在异步中引入则会报错。 比如需要遍历出很多图片展示时 <image :src = require('图片的路径') /> 第二种,可引入多个图片,也可引入单个图片。 vuelic3版本没有static文件夹。可将静态图片存放到public目录下,直接引入即可 <i 阅读全文
posted @ 2019-12-16 14:50 武卡卡 阅读(22811) 评论(1) 推荐(8) 编辑
摘要:/* 为对应的路由跳转时设置动画效果 */ <transition name="fade"> <router-view /> </transition> .fade-enter-active, .fade-leave-avtive { transition: opacity 1s } .fade-e 阅读全文
posted @ 2019-12-10 09:33 武卡卡 阅读(3042) 评论(0) 推荐(0) 编辑
摘要:<img class="headImg" :src="require('../../assets/uploads/'+headImg)" alt="图片资源"> 阅读全文
posted @ 2019-12-03 20:47 武卡卡 阅读(1175) 评论(0) 推荐(0) 编辑
摘要:<div class="right userPicture" :style="[{'background':`url(${userImg}) no-repeat center`},{'background-size': 'cover'}]"></div> 阅读全文
posted @ 2019-12-03 20:30 武卡卡 阅读(6226) 评论(0) 推荐(2) 编辑
摘要:一定要将静态资源引入 【 require("@/assets/") 】,绑定到 模型绑定的:src 数据中 动态的数据才能有效 <template> <div> <el-card class="box-card"> <div slot="header" class="clearfix"> <span 阅读全文
posted @ 2019-11-23 21:26 武卡卡 阅读(5076) 评论(0) 推荐(0) 编辑
摘要:直接上代码。 <template> <div> <el-upload action="http://localhost:3000/picture" :http-request = "getimages" :before-upload = "beforeUp" :headers="headers" l 阅读全文
posted @ 2019-11-22 23:04 武卡卡 阅读(329) 评论(0) 推荐(0) 编辑
摘要:一,只有在上传文件之前的钩子函数中才可以获得最初的文件(文件本身的二进制形式),用以以上传服务器。 还需要使用formdata来承载数据,便于接收 <template> <div> <el-upload action="http://localhost:3000/picture" :http-req 阅读全文
posted @ 2019-11-21 22:40 武卡卡 阅读(4503) 评论(0) 推荐(1) 编辑
摘要:<template> <div> <el-upload action="http://localhost:3000/picture" :headers="headers" list-type="picture-card" :on-preview="handlePictureCardPreview" 阅读全文
posted @ 2019-11-19 05:41 武卡卡 阅读(6247) 评论(0) 推荐(0) 编辑

喜欢请打赏

扫描二维码打赏

支付宝打赏

点击右上角即可分享
微信分享提示