quasar2 notify-actions-dismiss样式
功能:修改 notify的 【关闭】的样式,并提出共通
官网是这样的 (https://quasar.dev/quasar-plugins/notify#setting-attributes)
要求改成这样的
1.在src文件夹下建文件夹 common ,建文件 index.js,代码:
import { Notify } from 'quasar'
export function myNotify (msg,type) {
Notify.create({
// 提示内容
message: msg,
// 提示的类型(positive/warning/negative/...)
type: type,
// 位置
position: 'center',
actions: [
{
// 图标样式
icon: 'cancel',
// 图标颜色
color: 'white',
// class 这个我是F12看里面有什么quasar自带的类,试的
class: 'q-btn--round'
}
]
})
}
注:用原有的文件夹和自己新建文件夹使用方法是不一样的
2.使用测试
<script>
import { defineComponent } from 'vue'
import { myNotify } from '../../common/index'
export default defineComponent({
setup () {
return {
//一个按钮的点击事件 html部分我就不写了
buttonClickFunction () {
myNotify('Jim just pinged you', 'primary')
}
}
}
})
</script>