Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a Vue project that uses MintUI

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report