首页 > 编程语言 >element ui 的messageBox中绑定vnode节点

element ui 的messageBox中绑定vnode节点

时间:2023-09-22 16:12:02浏览次数:48  
标签:myFunction messageBox name style vnode ui props 组件 message

<template>
  <div class="about">
    <h1>This is an about page</h1>
    <el-button type="primary" size="default" @click="onTest">测试</el-button>
    <div>
     
    </div>
  </div>
</template>
<script>
  export default {
  name: 'about',
  data() {
    return {
      time:5,
      number:1235455
    }
  },
  mounted() {
    window.myFunction = this.myFunction;
  },
  methods: {

    onTest(){
      const h = this.$createElement;
        // this.$confirm(`<div>此操作将永久删除该文件, 是否继续</div>?<button onclick='myFunction()'>查询</button>`, '提示', {
        this.$confirm( h('div', null, [`此操作将${this.time}分钟后永久删除该文件${this.number}, 是否继续`,
            h('el-button', {on: {
                click: this.myFunction
              },attrs: {
    type: 'text'
  },}, '查询 ',),
            h('i', { style: 'color: teal' }, 'VNode')
          ]), '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          dangerouslyUseHTMLString: true,
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
    },
    myFunction(){
      alert('你好啊')
    }
  },
}
</script>

深入数据对象

有一点要注意:正如 v-bind:class 和 v-bind:style 在模板语法中会被特别对待一样,它们在 VNode 数据对象中也有对应的顶层字段。该对象也允许你绑定普通的 HTML attribute,也允许绑定如 innerHTML 这样的 DOM property (这会覆盖 v-html 指令)。

{
// 与 `v-bind:class` 的 API 相同,
// 接受一个字符串、对象或字符串和对象组成的数组
'class': {
foo: true,
bar: false
},
// 与 `v-bind:style` 的 API 相同,
// 接受一个字符串、对象,或对象组成的数组
style: {
color: 'red',
fontSize: '14px'
},
// 普通的 HTML attribute
attrs: {
id: 'foo'
},
// 组件 prop
props: {
myProp: 'bar'
},
// DOM property
domProps: {
innerHTML: 'baz'
},
// 事件监听器在 `on` 内,
// 但不再支持如 `v-on:keyup.enter` 这样的修饰器。
// 需要在处理函数中手动检查 keyCode。
on: {
click: this.clickHandler
},
 // 仅用于组件,用于监听原生事件,而不是组件内部使用
// `vm.$emit` 触发的事件。
nativeOn: {
click: this.nativeClickHandler
},
 // 自定义指令。注意,你无法对 `binding` 中的 `oldValue`
// 赋值,因为 Vue 已经自动为你进行了同步。
 directives: [
{
name: 'my-custom-directive',
value: '2',
expression: '1 + 1',
arg: 'foo',
modifiers: {
bar: true
}
}
],
 // 作用域插槽的格式为
// { name: props => VNode | Array<VNode> }
scopedSlots: {
default: props => createElement('span', props.text)
},
 // 如果组件是其它组件的子组件,需为插槽指定名称
 slot: 'name-of-slot',
// 其它特殊顶层 property
key: 'myKey',
ref: 'myRef',
// 如果你在渲染函数中给多个元素都应用了相同的 ref 名,
// 那么 `$refs.myRef` 会变成一个数组。
refInFor: true
}

标签:myFunction,messageBox,name,style,vnode,ui,props,组件,message
From: https://www.cnblogs.com/xiaobaizitaibai/p/17722626.html

相关文章

  • HbuilderX将Vue项目打包后的dist,打包成安卓apk安装包
    1、先看这个(必看):https://www.cnblogs.com/lyt520/p/16545806.html2、安装移动端log(如不需要可跳过此步骤)npminstallvconsolemain.js中引入:importVConsolefrom'vconsole'constvConsole=newVConsole()Vue.use(vConsole)3、HBuilderX和逍遥模拟器(用模拟器实现真......
  • Java 21的StringBuilder和StringBuffer新增了一个repeat方法
    发现Java21的StringBuilder和StringBuffer中多了repeat方法:/***@throwsIllegalArgumentException{@inheritDoc}**@since21*/@OverridepublicStringBuilderrepeat(intcodePoint,intcount){super.repeat(codePoint,co......
  • OpenHarmony应用开发—ArkUI组件集合
    介绍本示例为ArkUI中组件、通用、动画、全局方法的集合。效果预览 使用说明:1.点击组件、通用、动画、全局方法四个按钮或左右滑动切换不同视图。2.点击二级导航(如通用属性、通用事件等),若存在三级导航则展开三级导航(如Border 边框、点击事件等);若不存在三级导航,则跳转......
  • javascript: The Best Guided Tour Plugin
    BestTourPluginsToGuideVisitorsThroughYourApphttps://yonkov.github.io/post/display-shepherd-only-once/https://www.jqueryscript.net/blog/best-guided-tour.htmlhttps://whatfix.com/blog/react-onboarding-tour/https://github.com/shipshapecode/shepherdhtt......
  • MFC-GUI常用API
    替换m_comboSNCodeRandom.ResetContent();m_comboSNCodeRandom.AddString("数字0-9");m_comboSNCodeRandom.AddString("大写字母A-Z");m_comboSNCodeRandom.AddString("小写字母a-z");m_comboSNCodeRandom.InsertString(0,"数字0-9");m_comb......
  • DesignWare Building Block IP学习
    DesignWareBuildingBlock1.基本介绍DesignWareBuildingBlockIP(以下简称DWBB),也叫做FoundationLibrary,是一个紧密集成在Synopsys综合环境中的可重用智能功能块集合。使用DWBB可以在综合时实现透明且高水平的性能优化。DWBB中含有大量组件,可以实现设计重用并显著地提升生......
  • Vue执行和开发流程、登录小案例、混入、插件、elementui
    一、Vue执行流程1、vue的执行流程#1为什么浏览器中访问某个地址,会显示某个页面组件 -根组件:App.vue必须是<template><divid="app"><router-view></router-view></div> </template> -1配置路由 router--......
  • GUI编程1
    GUI编程1组件窗口弹窗面板文本框列表框按钮图片监听事件鼠标键盘事件破解工具1、简介Gui的核心技术:SwingAWT1.因为界面不美观。2需要jre环境!为什么我们要学习?可以写出自己心中想要的一些小工具工作时候,也可能需要维护到swing界面,概率极小!了解MVC架构,......
  • layui表格中关键字加粗加红显示
    使layui表格中根据关键词进行加红加粗显示,先看效果前台代码<scripttab="table处理及事件">vartable=layui.table;layui.use(['table'],function(){table.render({id:'ID-table-news',elem:'#ID-table-n......
  • 直播平台搭建,使用element-ui中的select下拉框
    直播平台搭建,使用element-ui中的select下拉框话不多说,上代码:  <el-selectv-model="value"filterableplaceholder="请选择">   <el-optionv-for="(item,index)inoptions":key="index":value="item.value":label="la......