Vue项目中修改IView的默认样式 以修改Modal组件的默认样式为例

问题描述

在开发过程中使用IView组件库中的Modal组件,想要修改Modal的宽度,但是直接修改Modal组件自带的类名不生效。

解决办法(以修改Modal组件宽度为例)

官方文档提供了如何修改Modal自定义样式的方法:IView-Modal对话框

在Modal组件中使用class-name来给对话框容器添加类名,添加的类名加到了.ivu-modal-wrap这一容器上,可以辅助实现我们想要的自定义效果。

		   <template>
		  	   <Modal
			        class-name="modify-style"
			        title="修改IView默认样式">
			   </modal>
			   <Modal
			   		title="修改IView默认样式"
		            :styles="{width: '800px'}">
		        </Modal>
		   <template>
		   <style>
		   		.modify-style .ivu-modal {
		   			width:800px !important;
		   		}
		   	</style>

如果对你有所帮助,请记得一键三联哦

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
好的,根据您的需求,我对代码进行了修改,并添加了获取响应头的 Cookies 的代码: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <div id="app"> <el-button type="primary" @click="addRequest">添加</el-button> <el-input v-model="username" placeholder="请输入内容"></el-input> <el-input v-model="password" placeholder="请输入内容"></el-input> </div> <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.0/vue.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.js"></script> <!-- 引入样式 --> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <!-- 引入组件库 --> <script src="https://unpkg.com/element-ui/lib/index.js"></script> <script> let MyVue = new Vue({ el: '#app', data() { return { username: "114514", password: "114514", } }, methods: { addRequest: function() { $.ajax({ url: "http://localhost:8080/hello", type: "POST", contentType: 'application/x-www-form-urlencoded', xhrFields: { withCredentials: true // 允许发送和接收 cookie }, success: function(res, status, xhr) { console.log(JSON.parse(res)); console.log(xhr.getResponseHeader('Set-Cookie')); // 获取响应头的 Cookies }, error: function(xhr, status, error) { console.log(error); } }) } } }) </script> </body> </html> ``` 需要注意的是,此方法只适用于在同一域名下的请求。如果您需要跨域获取 Cookies,需要在服务器端设置相关的 CORS 配置。另外,由于您的代码使用了箭头函数,我将其改为了普通函数,以避免出现 this 指向错误的问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值