Introduction#
Just directly download the package and import it into the project. I saw that there is Bower in the FastAdmin framework, which is a package manager for web development. I'm going to try installing and using it.
Reference Link#
Installing Vue with Bower#
- Since I haven't installed Bower before, I need to install it first with npm install bower.
- Open the bower.jsonfile in the root directory of the project and add a line following the existing package name and version:"vue": "~2.6.14".
- After saving, execute bower update.
- Because the framework has a configuration file .bowerrc, it will automatically download to the specified directorypublic/assets/libs.
Importing Vue#
- Modify the content of the file public/assets/js/backend-init.jsas follows to import Vue:
- Execute php think min -m all -r allto compress the JavaScript files, so thatdebug=falsecan also be used.
define(['backend'], function (Backend) {
    require.config({
        paths: {
            'layui': '../libs/layui/layui',
            'vue': '../libs/vue/dist/vue.min',
        },
        shim: {
            'layui':{
                deps:['css!../libs/layui/css/layui.css'],
                exports: "layui"
            },
        }
    });
});
Usage#
define(['jquery', 'bootstrap', 'backend','vue'], function ($, undefined, Backend, Vue) {
    var app = new Vue({
        el: '#main',
        created: function (){
            console.log('hello vue')
        }
    })
});