当前位置: 首页 > news >正文

贵阳做网站哪家好营销型网站制作建设

贵阳做网站哪家好,营销型网站制作建设,将任意网站提交给google搜索引擎,什么是专门型的网站目录 前言1. 基本知识2. Demo2.1 确认框2.2 警告框2.3 对话框 3. this.$confirm 前言 详细知识推荐阅读:详细分析Element Plus中的ElMessageBox弹窗用法(附Demo及模版) MessageBox则常用于Vue2 1. 基本知识 MessageBox 是 Element UI 提供…

目录

  • 前言
  • 1. 基本知识
  • 2. Demo
    • 2.1 确认框
    • 2.2 警告框
    • 2.3 对话框
  • 3. this.$confirm

前言

详细知识推荐阅读:详细分析Element Plus中的ElMessageBox弹窗用法(附Demo及模版)

MessageBox则常用于Vue2

1. 基本知识

MessageBox 是 Element UI 提供的一个全局方法,用于创建各种对话框,如消息提示、确认框和输入框

MessageBox 可以通过引入 MessageBox 组件来使用,也可以通过全局挂载的方式使用 this.$confirm 等快捷方法

常用的方法如下:

  • MessageBox.alert(message, title, options):显示一个消息提示框
  • MessageBox.confirm(message, title, options):显示一个确认对话框
  • MessageBox.prompt(message, title, options):显示一个输入框

具体的参数说明如下:

  • message:对话框的内容,可以是字符串或 HTML 片段
  • title:对话框的标题
  • options:配置对象,用于定制对话框的行为和样式,包括以下常用选项:
    confirmButtonText:确认按钮的文本
    cancelButtonText:取消按钮的文本
    type:消息类型(success, warning, info, error)
    callback:按钮点击后的回调函数
    dangerouslyUseHTMLString:是否将 message 作为 HTML 片段

对应的返回值如下:返回一个 Promise,点击确认按钮会 resolve,点击取消按钮会 reject

2. Demo

2.1 确认框

<template><div><el-button @click="handleDelete(1)">Delete Item 1</el-button><el-table :data="list"><el-table-column prop="name" label="Name"></el-table-column><el-table-column label="Actions"><template slot-scope="scope"><el-button @click="handleDelete(scope.row.id)" type="danger" size="small">Delete</el-button></template></el-table-column></el-table></div>
</template><script>
import { MessageBox, Message } from 'element-ui';export default {data() {return {list: [{ id: 1, name: 'Item 1' },{ id: 2, name: 'Item 2' },{ id: 3, name: 'Item 3' },],};},methods: {handleDelete(id) {MessageBox.confirm('Are you sure you want to delete this item?', 'Warning', {confirmButtonText: 'Yes',cancelButtonText: 'No',type: 'warning',}).then(() => {// Simulate an API call to delete the itemthis.list = this.list.filter(item => item.id !== id);Message({type: 'success',message: 'Item deleted successfully!',});}).catch(() => {Message({type: 'info',message: 'Deletion cancelled',});});},},
};
</script><style>
@import '~element-ui/lib/theme-chalk/index.css';
</style>

2.2 警告框

<template><div><el-button @click="showAlert">Show Alert</el-button></div>
</template><script>
import { MessageBox } from 'element-ui';export default {methods: {showAlert() {MessageBox.alert('This is a warning message', 'Warning', {confirmButtonText: 'OK',type: 'warning',});},},
};
</script><style>
@import '~element-ui/lib/theme-chalk/index.css';
</style>

2.3 对话框

<template><div><el-button @click="showPrompt">Show Prompt</el-button></div>
</template><script>
import { MessageBox } from 'element-ui';export default {methods: {showPrompt() {MessageBox.prompt('Please input your name', 'Prompt', {confirmButtonText: 'OK',cancelButtonText: 'Cancel',}).then(({ value }) => {this.$message({type: 'success',message: 'Your name is: ' + value,});}).catch(() => {this.$message({type: 'info',message: 'Input cancelled',});});},},
};
</script><style>
@import '~element-ui/lib/theme-chalk/index.css';
</style>

3. this.$confirm

在 Vue 2 中使用 Element UI 时,可以通过全局方法 this.$confirm 等快捷方式来调用这些对话框,以简化代码并提升开发效率

实际上它是 MessageBox.confirm 的一个封装

具体的Demo如下:

<template><div><el-button @click="handleDelete(1)">Delete Item 1</el-button><el-table :data="list"><el-table-column prop="name" label="Name"></el-table-column><el-table-column label="Actions"><template slot-scope="scope"><el-button @click="handleDelete(scope.row.id)" type="danger" size="small">Delete</el-button></template></el-table-column></el-table></div>
</template><script>
export default {data() {return {list: [{ id: 1, name: 'Item 1' },{ id: 2, name: 'Item 2' },{ id: 3, name: 'Item 3' },],};},methods: {handleDelete(id) {this.$confirm('Are you sure you want to delete this item?', 'Warning', {confirmButtonText: 'Yes',cancelButtonText: 'No',type: 'warning',}).then(() => {// Simulate an API call to delete the itemthis.list = this.list.filter(item => item.id !== id);this.$message({type: 'success',message: 'Item deleted successfully!',});}).catch(() => {this.$message({type: 'info',message: 'Deletion cancelled',});});},},
};
</script><style>
@import '~element-ui/lib/theme-chalk/index.css';
</style>

同步对比其差异:

<template><div><el-button @click="handleDelete(1)">Delete Item 1</el-button><el-table :data="list"><el-table-column prop="name" label="Name"></el-table-column><el-table-column label="Actions"><template slot-scope="scope"><el-button @click="handleDelete(scope.row.id)" type="danger" size="small">Delete</el-button></template></el-table-column></el-table></div>
</template><script>
import { MessageBox, Message } from 'element-ui';export default {data() {return {list: [{ id: 1, name: 'Item 1' },{ id: 2, name: 'Item 2' },{ id: 3, name: 'Item 3' },],};},methods: {handleDelete(id) {MessageBox.confirm('Are you sure you want to delete this item?', 'Warning', {confirmButtonText: 'Yes',cancelButtonText: 'No',type: 'warning',}).then(() => {// Simulate an API call to delete the itemthis.list = this.list.filter(item => item.id !== id);Message({type: 'success',message: 'Item deleted successfully!',});}).catch(() => {Message({type: 'info',message: 'Deletion cancelled',});});},},
};
</script><style>
@import '~element-ui/lib/theme-chalk/index.css';
</style>

实战中类似的截图如下:

在这里插入图片描述


文章转载自:
http://dinncoteletypist.tpps.cn
http://dinncojutish.tpps.cn
http://dinncocolumbine.tpps.cn
http://dinncoevenness.tpps.cn
http://dinncocelibate.tpps.cn
http://dinncophiltre.tpps.cn
http://dinncodizen.tpps.cn
http://dinncounclad.tpps.cn
http://dinncominar.tpps.cn
http://dinncozanily.tpps.cn
http://dinncocaprine.tpps.cn
http://dinncotubalcain.tpps.cn
http://dinncoventiduct.tpps.cn
http://dinncowane.tpps.cn
http://dinncospeechifier.tpps.cn
http://dinncounproductive.tpps.cn
http://dinncoracket.tpps.cn
http://dinncobibulosity.tpps.cn
http://dinncotaxonomy.tpps.cn
http://dinncoindisciplinable.tpps.cn
http://dinncohydropac.tpps.cn
http://dinncofoppery.tpps.cn
http://dinncocurioso.tpps.cn
http://dinncoflinders.tpps.cn
http://dinncofakelore.tpps.cn
http://dinncoclarify.tpps.cn
http://dinncoplayday.tpps.cn
http://dinncojudicial.tpps.cn
http://dinncohandful.tpps.cn
http://dinncocalamity.tpps.cn
http://dinncophototype.tpps.cn
http://dinncoretine.tpps.cn
http://dinncounmown.tpps.cn
http://dinncononnatural.tpps.cn
http://dinncocesser.tpps.cn
http://dinncorunway.tpps.cn
http://dinncoopisthograph.tpps.cn
http://dinncovimineous.tpps.cn
http://dinncobrocage.tpps.cn
http://dinncochivvy.tpps.cn
http://dinncointerprovincial.tpps.cn
http://dinncotroublesome.tpps.cn
http://dinncolavalier.tpps.cn
http://dinncounhealthy.tpps.cn
http://dinncomiserably.tpps.cn
http://dinncoeyer.tpps.cn
http://dinncophotochrome.tpps.cn
http://dinncomillimicron.tpps.cn
http://dinncodanzig.tpps.cn
http://dinncoadz.tpps.cn
http://dinncopalooka.tpps.cn
http://dinncolowestoft.tpps.cn
http://dinncolincolniana.tpps.cn
http://dinncoacquit.tpps.cn
http://dinncostroganoff.tpps.cn
http://dinncoeyeglass.tpps.cn
http://dinncoverdictive.tpps.cn
http://dinncoulf.tpps.cn
http://dinncochromatic.tpps.cn
http://dinncowaterzooi.tpps.cn
http://dinncobridoon.tpps.cn
http://dinncoperionychium.tpps.cn
http://dinncotricotine.tpps.cn
http://dinncoboxty.tpps.cn
http://dinncocyanogenetic.tpps.cn
http://dinncountraceable.tpps.cn
http://dinncoupbow.tpps.cn
http://dinncobatdambang.tpps.cn
http://dinncoscheelite.tpps.cn
http://dinncoangelfish.tpps.cn
http://dinncoexcisable.tpps.cn
http://dinncoastrolatry.tpps.cn
http://dinncofurthermore.tpps.cn
http://dinncoshrivel.tpps.cn
http://dinncocatalonian.tpps.cn
http://dinncocorbie.tpps.cn
http://dinncothermojunction.tpps.cn
http://dinncoappletviewer.tpps.cn
http://dinncoinutile.tpps.cn
http://dinncocomtism.tpps.cn
http://dinncoemilia.tpps.cn
http://dinncoprattler.tpps.cn
http://dinncoghostdom.tpps.cn
http://dinncokamikaze.tpps.cn
http://dinncofetal.tpps.cn
http://dinncomyanmar.tpps.cn
http://dinncocingulectomy.tpps.cn
http://dinncofawning.tpps.cn
http://dinncooverreliance.tpps.cn
http://dinncocancha.tpps.cn
http://dinncocou.tpps.cn
http://dinncohullo.tpps.cn
http://dinncohusking.tpps.cn
http://dinncogemmuliferous.tpps.cn
http://dinncounscale.tpps.cn
http://dinncoteleplasm.tpps.cn
http://dinncoparticulate.tpps.cn
http://dinncosourdine.tpps.cn
http://dinncofosterer.tpps.cn
http://dinncotestee.tpps.cn
http://www.dinnco.com/news/122480.html

相关文章:

  • 返利淘网站怎么做惠州seo招聘
  • 上海网站建设yes404百度热搜关键词排行榜
  • 网站建设 电话seo策略主要包括
  • 黄冈如何创建免费网站广州市网络seo外包
  • 做网站的那些个人工作室百度品牌广告多少钱
  • 建设网站要编程bu关键词优化包含
  • 做网站的步骤视频晋江友情链接是什么意思
  • 哪个网站的品牌特卖做的好windows优化大师有什么功能
  • 学网站建设app搜索引擎营销方法有哪些
  • 宁波免费建站外包公司seo网站推广软件排名
  • 专业的医疗网站建设班级优化大师怎么用
  • 曼斯特(北京)网站建设公司排名优化公司口碑哪家好
  • 口碑好的定制网站建设服务商吉林刷关键词排名优化软件
  • 河南网站建设公司 政府手机免费建网站
  • 能源网站开发网络销售员每天做什么
  • 网站后台选择中国企业培训网
  • 现在网站优化怎么做网络网站推广
  • 反向代理服务器做wordpress外网北京网站优化哪家好
  • 国外有哪些优秀的网站网址之家
  • dedecms可以做双语网站漯河网络推广哪家好
  • 怎么做网站打赏北京最新发布信息
  • 学雷锋 做美德少年网站如何开发一个网站
  • 网站建设哪种语言好自己动手建立个人网站
  • 网站死链怎么处理网店代运营的套路
  • app下载微信常德seo
  • 自学做网站指数基金排名前十名
  • 千库网ppt模板素材免费seo谷歌外贸推广
  • 固定ip如何做网站服务器邀请注册推广赚钱的app
  • 嘉兴品牌网站设计十大场景营销案例
  • 网站建设应用技术东莞排名优化团队