应无所住,而生其心
排名
1
文章
860
粉丝
112
评论
163
net core webapi post传递参数
庸人 : 确实坑哈,我也是下班好了好几次,发现后台传递对象是可以的,但...
百度编辑器自定义模板
庸人 : 我建议换个编辑器,因为现在百度富文本已经停止维护了,用tinymec...
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术

vue elementui 弹窗el-dialog,自定义弹窗样式,单选按钮el-radio联动

6904人阅读 2020/7/17 12:19 总访问:5182733 评论:0 收藏:0 手机
分类: 前端

效果如下:

代码如下:

  1. <!-- 处理问题反馈使用的弹窗 -->
  2. <template>
  3. <div>
  4. <!-- 弹窗start -->
  5. <div class="dialogContent">
  6. <el-dialog
  7. :visible.sync="dialogVisible"
  8. :show-close="false"
  9. width="780px"
  10. height="800px"
  11. :before-close="handleClose"
  12. >
  13. <div slot="title" class="dialog-footer">
  14. <div style="font-size:16px">
  15. 问题反馈
  16. </div>
  17. <div class="separateline" />
  18. </div>
  19. <div style="margin-top:-10px">
  20. <div style="display:flex">
  21. <div style="width:78px;color:#000">
  22. 处理类型:
  23. </div>
  24. <div>
  25. <el-radio v-model="feedbackType" label="1" @change="feedbackTypeChange">同意处理</el-radio>
  26. <el-radio v-model="feedbackType" label="2" @change="feedbackTypeChange">驳回处理</el-radio>
  27. <!-- <el-radio v-model="feedbackType" label="3">不理不睬</el-radio> -->
  28. </div>
  29. </div>
  30. <div style="display:flex;margin-top: 30px;">
  31. <div style="width:78px;color:#000;">
  32. 处理意见
  33. </div>
  34. <div style="flex-grow: 1">
  35. <el-input v-model="describe" type="textarea" style="width:100%" :rows="7" placeholder="请输入内容" />
  36. </div>
  37. </div>
  38. <div style="display:flex;margin-top: 30px;">
  39. <div style="width:78px;color:#000;">
  40. 快捷回复
  41. </div>
  42. <div v-if="feedbackType==1">
  43. <div>
  44. <el-radio v-model="quicklyResponse" label="1" @change="quicklyResponseChange('感谢你的吐槽,我们将继续努力,争取得到你的认可!你的吐槽是我们前进的动力')">感谢你的吐槽,我们将继续努力,争取得到你的认可!你的吐槽是我们前进的动力!</el-radio>
  45. </div>
  46. <div>
  47. <el-radio v-model="quicklyResponse" label="2" @change="quicklyResponseChange('感谢你的反馈,问题已经修改!你的付出让我们进步了!谢谢!')">感谢你的反馈,问题已经修改!你的付出让我们进步了!谢谢!</el-radio>
  48. </div>
  49. <div>
  50. <el-radio v-model="quicklyResponse" label="3" @change="quicklyResponseChange('问题已处理,欢迎继续提出优化方案!你我写作,平台明天将更好!')">问题已处理,欢迎继续提出优化方案!你我协作,平台明天将更好!</el-radio>
  51. </div>
  52. </div>
  53. <div v-if="feedbackType==2">
  54. <div>
  55. <el-radio v-model="quicklyResponse" label="4" @change="quicklyResponseChange('感谢你的反馈,经过多方验证,未发现该为问题,请检查你的使用环境,建议使用谷歌浏览器!!')">感谢你的反馈,经过多方验证,未发现该为问题,请检查你的使用环境,建议使用谷歌浏览器!!</el-radio>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <span slot="footer" class="dialog-footer">
  61. <el-button size="small" @click="dialogVisible = false">我在想想</el-button>
  62. <el-button type="primary" size="small" @click="saveFeedback()">确定反馈</el-button>
  63. </span>
  64. </el-dialog>
  65. </div>
  66. <!-- 弹窗end -->
  67. </div>
  68. </template>
  69. <script>
  70. export default {
  71. // 组件名字
  72. name: 'FeedbackDialog',
  73. // 组件参数
  74. props: {
  75. index: {
  76. type: Number,
  77. default: 0
  78. }
  79. },
  80. data() {
  81. return {
  82. feedbackType: '1',
  83. feedbackId: 0,
  84. describe: '',
  85. quicklyResponse: '0',
  86. dialogVisible: false
  87. }
  88. },
  89. mounted() {
  90. // alert("组件内部加载好了"+this.dialogVisibleParameter)
  91. this.initPic()
  92. },
  93. // 组件方法
  94. methods: {
  95. initPic() {
  96. },
  97. // 反馈类型改变后还是清空一下选择看着舒服点
  98. feedbackTypeChange() {
  99. this.quicklyResponse = '0'
  100. this.describe = ''
  101. },
  102. quicklyResponseChange(value) {
  103. this.describe = value
  104. },
  105. // 模态框关闭前的事件
  106. handleClose(done) {
  107. },
  108. // 打开弹窗
  109. openFeedbackDialog(feedbackId) {
  110. // 先把上一次填写的数据先清理一下
  111. this.quicklyResponse = '0'
  112. this.describe = ''
  113. this.feedbackId = feedbackId
  114. this.dialogVisible = true
  115. },
  116. // 清空一下反馈的数据,比如反馈成功之后清空一下,这样下次打开的时候不会让前面的数据还在
  117. clearFeedbackData() {
  118. this.describe = ''
  119. this.feedbackType = '1'
  120. },
  121. // 处理反馈
  122. saveFeedback() {
  123. // this.$alert('功能开发中...')
  124. const _this = this
  125. if (!this.describe) {
  126. this.$alert('请输入反馈意见...')
  127. return
  128. }
  129. // 反馈回传的数据
  130. const feedbackData = {
  131. DealType: this.feedbackType, // 处理类型
  132. DealingOpinion: this.describe, // 处理意见
  133. Id: this.feedbackId
  134. }
  135. this.$http.post('/education/api/Feedback/DealFeedback', feedbackData).then((res) => {
  136. // _this.$alert('处理反馈成功!...')
  137. _this.dialogVisible = false
  138. // 调用父组件的刷新方法
  139. _this.$parent.getData()
  140. // 清空一下上次处理的数据
  141. _this.clearFeedbackData()
  142. console.log(res)
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style scoped="scoped" lang="scss">
  149. // 自定义的一根简单分割线
  150. .separateline {
  151. height: 1px;
  152. background: #eee;
  153. margin-left: -40px;
  154. margin-right: -40px;
  155. margin-top: 9px;
  156. }
  157. // 问题截图,传递图片的样式
  158. .form-content.panle {
  159. // padding: 20px;
  160. padding-bottom: 10px;
  161. // background-color: #f8f8f8;
  162. .img-boxs {
  163. display: flex;
  164. /* margin-right: 46px; */
  165. flex-wrap: wrap;
  166. .img-waper {
  167. margin-right: 10px;
  168. margin-bottom: 10px;
  169. position: relative;
  170. .remove-icon:hover {
  171. cursor: pointer;
  172. img {
  173. opacity: 0.6;
  174. }
  175. }
  176. .remove-icon {
  177. position: absolute;
  178. width: 14px;
  179. height: 14px;
  180. top: -8px;
  181. right: -5px;
  182. img {
  183. width: 100%;
  184. }
  185. }
  186. }
  187. }
  188. .add-btn:hover {
  189. cursor: pointer;
  190. opacity: 0.6;
  191. }
  192. .add-btn {
  193. width: 70px;
  194. height: 70px;
  195. border: solid 1px #DDDDDD;
  196. display: flex;
  197. align-items: center;
  198. flex-wrap: wrap;
  199. justify-content: space-around;
  200. .icon-waper {
  201. width: 18px;
  202. height: 21px;
  203. position: relative;
  204. .icon-x {
  205. width: 19px;
  206. height: 5px;
  207. background-color: #DDDDDD;
  208. position: absolute;
  209. top: 0;
  210. bottom: 0;
  211. margin: auto;
  212. }
  213. .icon-y {
  214. height: 21px;
  215. width: 5px;
  216. background-color: #DDDDDD;
  217. position: absolute;
  218. left: 0;
  219. right: 0;
  220. margin: auto;
  221. }
  222. }
  223. }
  224. }
  225. </style>
  226. <!-- 修改elementui里边对话框的默认样式
  227. 需要注意两点:
  228. 1:样式声明的时候不要加scoped,不然样式只在当前组件起作用,无法覆盖样式内容的样式
  229. 2:要修改默认弹窗里边的样式,加一个前缀,就可以做到只修改当前这个组件的了,不然可能会影响到其他地方的样式
  230. -->
  231. <style lang="scss">
  232. // 修改el-dialog里边的默认样式
  233. .dialogContent {
  234. .el-dialog {
  235. background-color: #F6F8FC;
  236. }
  237. .el-dialog__header {
  238. padding: 20px 40px 10px 40px;
  239. background-color: #f6f8fc !important;
  240. }
  241. .el-dialog__body {
  242. padding: 30px 40px;
  243. color: #606266;
  244. font-size: 14px;
  245. word-break: break-all;
  246. }
  247. .el-dialog__footer {
  248. padding: 0px 40px 30px 40px
  249. }
  250. // 修改默认按钮的padding也就是跳转按钮的宽度
  251. .el-button--small,
  252. .el-button--small.is-round {
  253. padding: 9px 16px;
  254. }
  255. // 修改默认按钮的圆角为直角
  256. .el-button--mini,
  257. .el-button--small {
  258. border-radius: 0px;
  259. }
  260. }
  261. </style>

欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)

评价

vue elementui常用表单验证

&lt;script&gt; exportdefault{ name:&quot;form&quot;, data(){ //ip地址校验 varIPValidator=(rule,value,callbac...

vue elementui隐藏表格列。vue element-ui表格添加自增序号列

vue elementui隐藏表格列v-if就搞定了,如果不是动态的显示与隐藏直接设置成false就行 &lt;el-table-column label=&quot;...

vue elementuivue3 element plus 文件上传的时候设置其他参数。后台.net接收传递的额外参数。图片上传

比如上传文件的时候额外传递两个select选择的值 前台前面上传文件的时候要提供默认参数很简单,el-upload绑定一个data即可...

vue elementui 图片预览。el-image-viewer图片查看器。修改图片预览的自带样式。点击哪一个就查看哪一个图片

先引入图片预览的组件 import ElImageViewer from &#39;element-ui/packages/image/src/image-viewer&#39; export defa...

vue elementui 常用表格条件查询类型解析弹窗显示详情图片显示图片预览

[TOC]第一版 页面&lt;template&gt; &lt;div class=&quot;app-container&quot;&gt; &lt;el-card&gt; &lt;!-...

vue elementui 基础表格布局基础表格+条件+搜索框布局类型处理父子组件方法调用

[TOC]基础表格+条件+搜索框布局效果如下:代码如下: &lt;template&gt; &lt;div class=&quot;app-container&quot;&gt...

vue elementui分页条使用与.net后台sqlsugar等分页方法使用。常用分页模板

分页条&lt;div style=&quot;margin-top: 20px;margin-bottom: 20px;text-align: center;&quot;&gt; &lt;el-pagination ...

vue elementui table去掉滚动条

当table内容列过多时,可通过height属性设置table高度以固定table高度、固定表头,使table内容可以滚动。现在需求是右侧滚...

EasyUI弹窗批量修改combogrid下拉框的值

JS方法//点击弹出批量修改框 UpdateLot:function(){ varrow=$(&quot;#dg&quot;).datagrid(&quot;getChecked&quot;); if(...

layer弹窗+ef引入独立页面进行操作

使用layer弹窗进行操作的时候我们可以使用type=2,来把一个独立的页面指向content内容例如我们有一个表格,点击添加后,我...

百度编辑器在layer弹窗中加载问题

因为加载到layer后百度编辑器要从新渲染一遍,所以如果使用setContent(Content)设置的内容在加载到layer弹窗中是显示不出来...

表格在layer弹窗中居中表格居中

其实很简单直接给table设置一个margin:top auto就可以了layer:layer.open({ type:1, title:&quot;更新&quot;, area:[&qu...

layui 弹窗遮罩层把弹窗挡住问题

代码:layer.open({ type:1, area:[&quot;300px&quot;,&quot;300px&quot;], content:$(&quot;#addvieww&quot;) });分析...

layer弹窗i获取id

直接贴代码,这个实在yes回调函数里边执行的,通过index去找 yes: function (index) { var nowLayer = $(&quot;#layui-lay...

layer弹窗放jquery对象被遮住了

html &lt;div id=&quot;showcontent&quot; style=&quot;display: none&quot;&gt; hello layer &lt;/div&gt; js: l...