(小程序)基于uniapp+vite4+vue3搭建跨端項目|uni-app+uview-plus模板
版本信息:
HBuilderX: 3.8.4
Vite: 4.2.1
uView-Plus: 3.1.31
一、創(chuàng)建uniapp+vue3項目:
- 點擊編輯器的文件 > 新建 > 項目(快捷鍵Ctrl+N)
2.選擇uni-app項目,輸入項目名/路徑,選擇項目模板,勾選vue3版本,點擊創(chuàng)建,即可成功創(chuàng)建。
3.點擊編輯器的運行 > 運行到瀏覽器 > 選擇瀏覽器
當(dāng)然也可以運行到手機或模擬器、運行到小程序工具。
到這里一個簡單的uniapp+vue3項目就搭建好了。
二、引入uniapp+vue3組件庫uview-plus 和 uni-ui(略)
目前支持 uniapp vue3 組件庫有uni-ui(官方),uview-plus等。
1.使用hbuilderx 導(dǎo)入uview-plus組件庫
2.引入uview-plus及樣式 (3個文件)
// main.js
import uviewPlus from '@/uni_modules/uview-plus'
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(uviewPlus)
return {
app
}
}
/* uni.scss */
@import '@/uni_modules/uview-plus/theme.scss';
/* app.vue */
<style lang="scss">
/* 注意要寫在第一行,同時給style標簽加入lang="scss"屬性 */
@import "@/uni_modules/uview-plus/index.scss";
</style>
注:提交代碼時 uni-modules需要提交文章來源:http://www.zghlxwxcb.cn/news/detail-596227.html
解決參考:https://www.cnblogs.com/xiaoyan2017/p/17487018.html文章來源地址http://www.zghlxwxcb.cn/news/detail-596227.html
到了這里,關(guān)于(小程序)基于uniapp+vite4+vue3搭建跨端項目|uni-app+uview-plus模板的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!