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

营销型网站制作流程如何策划一个营销方案

营销型网站制作流程,如何策划一个营销方案,东莞专业网站推广多少钱,网站的建设和品牌价值的关系模拟系统的消息提示框而实现的一套模态对话框组件,用于消息提示、确认消息和提交内容。 从场景上说,MessageBox 的作用是美化系统自带的 alert、confirm 和 prompt,因此适合展示较为简单的内容。如果需要弹出较为复杂的内容,还是要…

模拟系统的消息提示框而实现的一套模态对话框组件,用于消息提示、确认消息和提交内容。

从场景上说,MessageBox 的作用是美化系统自带的 alertconfirm 和 prompt,因此适合展示较为简单的内容。如果需要弹出较为复杂的内容,还是要使用 Dialog。

1.消息提示

当用户进行操作时会被触发,该对话框中断用户操作,直到用户确认知晓后才可关闭。

/*调用$alert方法即可打开消息提示,它模拟了系统的 alert,无法通过按下 ESC 或点击框外关闭。此例中接收了两个参数,message和title。值得一提的是,窗口被关闭后,它默认会返回一个Promise对象便于进行后续操作的处理。若不确定浏览器是否支持Promise,可自行引入第三方 polyfill 或像本例一样使用回调进行后续处理。*/<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$alert('这是一段内容', '标题名称', {confirmButtonText: '确定',callback: action => {this.$message({type: 'info',message: `action: ${ action }`});}});}}}
</script>

2.确认消息

提示用户确认其已经触发的动作,并询问是否进行此操作时会用到此对话框。

/*调用$confirm方法即可打开消息提示,它模拟了系统的 confirm。Message Box 组件也拥有极高的定制性,我们可以传入options作为第三个参数,它是一个字面量对象。type字段表明消息类型,可以为success,error,info和warning,无效的设置将会被忽略。注意,第二个参数title必须定义为String类型,如果是Object,会被理解为options。在这里我们用了 Promise 来处理后续响应。*/<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {this.$message({type: 'success',message: '删除成功!'});}).catch(() => {this.$message({type: 'info',message: '已取消删除'});          });}}}
</script>

3.提交内容

当用户进行操作时会被触发,中断用户操作,提示用户进行输入的对话框。

/*调用$prompt方法即可打开消息提示,它模拟了系统的 prompt。可以用inputPattern字段自己规定匹配模式,或者用inputValidator规定校验函数,可以返回Boolean或String,返回false或字符串时均表示校验未通过,同时返回的字符串相当于定义了inputErrorMessage字段。此外,可以用inputPlaceholder字段来定义输入框的占位符。*/<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$prompt('请输入邮箱', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,inputErrorMessage: '邮箱格式不正确'}).then(({ value }) => {this.$message({type: 'success',message: '你的邮箱是: ' + value});}).catch(() => {this.$message({type: 'info',message: '取消输入'});       });}}}
</script>

4.自定义

可自定义配置不同内容。

以上三个方法都是对$msgbox方法的再包装。本例直接调用$msgbox方法,使用了showCancelButton字段,用于显示取消按钮。另外可使用cancelButtonClass为其添加自定义样式,使用cancelButtonText来自定义按钮文本(Confirm 按钮也具有相同的字段,在文末的字段说明中有完整的字段列表)。此例还使用了beforeClose属性,它的值是一个方法,会在 MessageBox 的实例关闭前被调用,同时暂停实例的关闭。它有三个参数:action、实例本身和done方法。使用它能够在关闭前对实例进行一些操作,比如为确定按钮添加loading状态等;此时若需要关闭实例,可以调用done方法(若在beforeClose中没有调用done,则实例不会关闭)。<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {const h = this.$createElement;this.$msgbox({title: '消息',message: h('p', null, [h('span', null, '内容可以是 '),h('i', { style: 'color: teal' }, 'VNode')]),showCancelButton: true,confirmButtonText: '确定',cancelButtonText: '取消',beforeClose: (action, instance, done) => {if (action === 'confirm') {instance.confirmButtonLoading = true;instance.confirmButtonText = '执行中...';setTimeout(() => {done();setTimeout(() => {instance.confirmButtonLoading = false;}, 300);}, 3000);} else {done();}}}).then(action => {this.$message({type: 'info',message: 'action: ' + action});});}}}
</script>

 弹出层的内容可以是 VNode,所以我们能把一些自定义组件传入其中。每次弹出层打开后,Vue 会对新老 VNode 节点进行比对,然后将根据比较结果进行最小单位地修改视图。这也许会造成弹出层内容区域的组件没有重新渲染,当这类问题出现时,解决方案是给 VNode 加上一个不相同的 key.

5. 使用 HTML 片段

message 属性支持传入 HTML 片段。

dangerouslyUseHTMLString属性设置为 true,message 就会被当作 HTML 片段处理。

<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$alert('<strong>这是 <i>HTML</i> 片段</strong>', 'HTML 片段', {dangerouslyUseHTMLString: true});}}}
</script>

message 属性虽然支持传入 HTML 片段,但是在网站上动态渲染任意 HTML 是非常危险的,因为容易导致 XSS 攻击。因此在 dangerouslyUseHTMLString 打开的情况下,请确保 message 的内容是可信的,永远不要将用户提交的内容赋值给 message 属性。

6.区分取消与关闭

有些场景下,点击取消按钮与点击关闭按钮有着不同的含义。

默认情况下,当用户触发取消(点击取消按钮)和触发关闭(点击关闭按钮或遮罩层、按下 ESC 键)时,Promise 的 reject 回调和callback回调的参数均为 'cancel'。如果将distinguishCancelAndClose属性设置为 true,则上述两种行为的参数分别为 'cancel' 和 'close'。

<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$confirm('检测到未保存的内容,是否在离开页面前保存修改?', '确认信息', {distinguishCancelAndClose: true,confirmButtonText: '保存',cancelButtonText: '放弃修改'}).then(() => {this.$message({type: 'info',message: '保存修改'});}).catch(action => {this.$message({type: 'info',message: action === 'cancel'? '放弃保存并离开页面': '停留在当前页面'})});}}}
</script>

7.居中布局

内容支持居中布局

将 center 设置为 true 即可开启居中布局

<template><el-button type="text" @click="open">点击打开 Message Box</el-button>
</template><script>export default {methods: {open() {this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning',center: true}).then(() => {this.$message({type: 'success',message: '删除成功!'});}).catch(() => {this.$message({type: 'info',message: '已取消删除'});});}}}
</script>

8.全局方法

如果你完整引入了 Element,它会为 Vue.prototype 添加如下全局方法:$msgbox, $alert, $confirm 和 $prompt。因此在 Vue instance 中可以采用本页面中的方式调用 MessageBox。调用参数为:

  • $msgbox(options)
  • $alert(message, title, options) 或 $alert(message, options)
  • $confirm(message, title, options) 或 $confirm(message, options)
  • $prompt(message, title, options) 或 $prompt(message, options)

9.单独引用

如果单独引入 MessageBox

import { MessageBox } from 'element-ui';

那么对应于上述四个全局方法的调用方法依次为:MessageBox, MessageBox.alert, MessageBox.confirm 和 MessageBox.prompt,调用参数与全局方法相同。

http://www.mmbaike.com/news/91694.html

相关文章:

  • wordpress 复制页面seo搜索引擎优化人才
  • 青岛网站推广怎么做好北京最新疫情最新消息
  • e时代网站制作网站怎么弄
  • 新疆建设网站首页seo站内优化站外优化
  • 制作网站的方法美国新冠疫情最新消息
  • 免费建网站软件下载手机西安疫情最新消息1小时内
  • 网站seo在线诊断分析网络营销的渠道有哪些
  • 如何做个盈利的网站网站建设公司哪个好呀
  • 响应式中文网站模板河南百度推广代理商
  • 义乌购网站做代销怎么样手机cpu性能增强软件
  • 阿里云建公司网站网络推广网络营销和网站推广的区别
  • 深圳竞价网站seo助手
  • 商汇通网站百度手机助手应用商店下载
  • 动态网站开发语言最流行的说哪种网站流量查询网站统计查询
  • app制作教程简单易学网络优化工程师招聘信息
  • 上海企业网站建设报价公司网站制作需要多少钱
  • 微信公众号运营模式seo综合查询国产
  • 网站建设石家庄软文推广文案范文
  • 苏州嘉盛建设工程有限公司网站网页广告
  • 村建站什么部门网络营销方法
  • 制作一个收费网站要多少钱seo和sem
  • 福州做网站设计网络推广的优化服务
  • 动态做网站成人职业技术培训学校
  • 中国建设银行网站类型分析排名首页服务热线
  • 网页设计价格影响因素海南seo
  • 长春市长春网站建设网长沙网站优化推广方案
  • 关闭网站怎么不保存我做的更改百度app安装下载
  • 怎么自己学做网站seo诊断
  • 太原做淘宝网站的郑州seo管理
  • 郑州北环网站建设培训如何查询网站收录情况