demo 原始链接:https://vux.li/demos/v2/#/component/msg
\n下面的$t是Demo的i18n使用的翻译函数,一般情况下可以直接使用字符串。另外,下面代码隐藏了i18n标签部分的代码。
\n<template>\n <div>\n <msg :title=\"$t('Yeah! You make it')\" :description=\"$t('Msg description')\" :buttons=\"buttons\" :icon=\"icon\"></msg>\n </div>\n</template>\n\n\n\n<script>\nimport { Msg, Divider, XButton } from 'vux'\n\nexport default {\n components: {\n Msg,\n Divider,\n XButton\n },\n methods: {\n changeIcon () {\n if (!this.icon || this.icon === 'success') {\n this.icon = 'warn'\n return\n }\n if (this.icon === 'warn') {\n this.icon = 'info'\n return\n }\n if (this.icon === 'info') {\n this.icon = 'waiting'\n return\n }\n if (this.icon === 'waiting') {\n this.icon = 'success'\n }\n }\n },\n data () {\n return {\n description: 'msg description',\n icon: '',\n buttons: [{\n type: 'primary',\n text: 'Primary button',\n onClick: this.changeIcon.bind(this)\n }, {\n type: 'default',\n text: 'Secondary button',\n link: '/demo'\n }]\n }\n }\n}\n</script>\n\n
\n