当前位置: 首页 > Web前端 > vue.js

常用Vue插件安装

时间:2023-03-31 19:52:51 vue.js

使用npm命令1.Element-UI安装命令npminstallelement-ui-SglobalreferenceimportVuefrom'vue';importAppfrom'./App.vue';importElementUIfrom'element-ui';import'element-ui/lib/theme-chalk/index.css';//useVue.use(ElementUI);newVue({el:'#app',render:h=>h(App)});使用组件参与官网:https://element.eleme.cn/#/zh-CN/component/installation2.mavonEditor安装命令npminstallmavon-editor--savereferenceimportVuefrom'vue'importmavonEditorfrom'mavon-inmain.jseditor'import'mavon-editor/dist/css/index.css'//useVue.use(mavonEditor)newVue({'el':'#main',data(){//这个data()可以不写return{value:''}}})组件被使用并放在页面上:3.axios安装命令npminstallaxios--savenpminstallvue-axios--save当然这两个句子也可以合为一句话:npminstallaxiosvue-axios--savereferenceimportVuefrom'vue'importaxiosfrom'axios'importVueAxiosfrom'vue-axios'//useVue.use(VueAxios,axios)组件使用Vue.axios.get(api).then((response)=>{console.log(response.data)})this.axios.get(api).then((response)=>{console.log(response.data)})this.$http.get(api).then((response)=>{console.log(response。数据)})