![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
xiaoShengSanYue
这个作者很懒,什么都没留下…
展开
-
vue 中使用 vue-pdf 显示PDF
<!DOCTYPE html><html lang="zh"><head> <style> canvas { margin-bottom: 8px; box-shadow: 0 2px 8px 4px rgba(0, 0, 0, 0.1); } .app-header { padding: 16px;原创 2021-11-18 15:24:49 · 1225 阅读 · 0 评论 -
在 vue 中使用字符串来调用函数
可以使用 const methodList = this.$options.methods 来获取到所有的函数名进而可以使用 methodList[methodStr]() 来调用函数, 但是这样会产生 this 指向问题, 所以如果在函数中如果有用到 this, 则可以在调用的时候将 this 作为参数传递过去如果想要在 js 中通过字符串来调用函数的话, 则可以使用 eval(methosStr + '()') 来调用...原创 2021-11-15 17:16:18 · 3514 阅读 · 0 评论 -
element-ui 中手动上传文件
代码如下<el-upload ref="upload" :auto-upload="false" :http-request="uploadWord"> <el-button size="small" type="primary">选择文件</el-button></el-upload><el-button size="small" type="primary" @click='upload'>点击上传</el-button>.原创 2021-08-31 14:41:40 · 933 阅读 · 1 评论 -
element-ui 中自定义上传回调函数参数
element-ui 文档中上传成功回调函数如下:其中三个参数, 但是如果想要在该钩子中新增参数的话, 可以如下操作:<el-upload class="avatar-uploader" :show-file-list="false" :action="uploadImageUrl" :on-success="response => uploadImageSuccess(response, index)"> <img v-if="teamItem.usericon" :sr.原创 2021-08-31 11:49:24 · 1467 阅读 · 0 评论 -
vue 中配置跨域问题
在项目根目录下新建 vue.config.js 文件,并写入以下内容module.exports = { devServer:{ // 本地域名 host:'localhost', // 本地端口 port:'8080', open:true, proxy:{ //配置跨域 // 当访问到 api 开头的接口时走下面的内容 '/api':{ // 最终想要访问的地址 ta..原创 2021-08-25 17:28:52 · 2505 阅读 · 0 评论 -
vue请求delete接口的时候报The DELETE method is not supported for this route. Supported methods: GET, HEAD, PO
在用vue的axios请求delete接口的时候报The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST,如下:vue中的代码如下:axios.delete('http://blog.test/api/type',{'id':id}).then(response => (console.log(response)))解决办法为: 修改一下传参的方式即可axios.原创 2020-06-06 18:53:05 · 2896 阅读 · 0 评论 -
Vue中关于v-on绑定点击事件时候的参数问题
v-on的绑定点击事件的时候关于参数有三种情况,分别如下 :绑定的方法后面没有括号 <button @click="btnClick">点击</button> <script> const app = new Vue({ methods:{ btnClick(event){ // 此时event就是当前点击的对象 console.log(event) } } }) </script>绑定的方.原创 2020-05-18 14:45:12 · 6244 阅读 · 0 评论 -
Vue中实现跑马灯效果
老样子,话不多说,直接上代码<!doctype html><html lang="zh-CN"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">.原创 2020-05-18 14:23:01 · 2746 阅读 · 0 评论 -
Vue实现简单购物车功能
话不多少,上效果图代码如下:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.css" rel="styleshe.原创 2020-05-17 10:24:02 · 536 阅读 · 0 评论 -
Vue中实现点击当前行变色
话不多说,先上效果默认第一行为红色,当点击第二行的时候,只有第二行变为红色代码如下:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> .active{ color: red;; } </s.原创 2020-05-17 10:00:31 · 12650 阅读 · 4 评论 -
在Vue中动态绑定label标签中的for (Interpolation inside attributes has been removed)
在Vue中想要动态绑定label中的for的值,一开始这样写的:<div id="app"> <label for="{{ name }}"><span>{{ message}}</span></label> <input type="text" id="{{ name }}" key="{{ name }}"> <button @click="loginType">切换类型</bu.原创 2020-05-16 22:46:37 · 6163 阅读 · 0 评论