How to build a Vue project that uses MintUI
This article introduces you how to build a Vue project using MintUI, the content is very detailed, interested friends can refer to, hope to be helpful to you.
MintUI, launched by the ele.me front-end team, is a Vue.js-based mobile component library. Since open source in early June, some bug has been fixed and some components have been added based on feedback from the community and team, and version 0.2.0 was released this week.
Installation of MintUI
Npm installation: npmimint-ui-S
The code for MintUI
/ / 1. Complete introduction
ImportVuefrom'vue'
ImportMintUIfrom'mint-ui'
Import'mint-ui/lib/style.css'
Vue.use (MintUI)
/ / 2. Introduce some components
Import {MessageBox} from'mint-ui'// pop-up prompt (error prompt)
Import {Toast} from'mint-ui';// short message prompt box (informational tip)
Import'mint-ui/lib/style.css'
Object.defineProperty (Vue.prototype,'$messageBox', {value:MessageBox})
Object.defineProperty (Vue.prototype,'$toast', {value:Toast})
Import {Loadmore} from'mint-ui'// drop-down / pull-up refresh
Vue.component (Loadmore.name,Loadmore)
/ / 3. Prompt box example
/ / xxx.vue
This.$toast ('like successfully')
This.$messageBox.alert ('Honey, the event is over')
/ / request.js (send a request to the server)
Import {Indicator,MessageBox} from'mint-ui'
Service.interceptors.request.use (config= > {/ / request interceptor
Indicator.open ('loading...') / / display the load prompt box
Returnconfig
})
Service.interceptors.response.use (/ / respone interceptor
Response= > {
Indicator.close () / / close the load prompt box
Constres=response.data
If (res.ReturnCodecodes) {
} else {
Returnres
}
}
Error= > {
Indicator.close ()
MessageBox.alert ('it's too hot, take it easy, honey, try again')
ReturnPromise.reject (error)
}
)
On how to build a Vue project using MintUI to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.