Home >Web Front-end >Vue.js >How to use layui in vue
How to use layui in vue: first put the package corresponding to layui in the static folder; then directly introduce [layui.js] and [layui.css] in [index.html]; finally Write relevant code in the created hook function in the vue component.
The operating environment of this tutorial: windows7 system, Vue2.9.6&&layui2.5.4 version. This method is suitable for all brands of computers.
[Related article recommendations: vue.js]
How to use layui in vue:
1. Put the package corresponding to layui under the static folder, so put it directly under static
2. Directly introduce layui.js and layui.css
3. Write the following code in the created hook function in the vue component
created(){ const _this = this; layui.use(['layer'],function(){ _this.layer = layui.layer, this.layer.msg('hello'); }) }
Related free learning recommendations: javascript learning tutorial
The above is the detailed content of How to use layui in vue. For more information, please follow other related articles on the PHP Chinese website!