56 lines
2.2 KiB
JavaScript
56 lines
2.2 KiB
JavaScript
import {
|
||
defineConfig
|
||
} from 'vite'
|
||
import uni from '@dcloudio/vite-plugin-uni'
|
||
// @yck-web/vite-plugin-template-inset
|
||
const htmlPlugin_ciy = () => {
|
||
return {
|
||
name: 'html-transform',
|
||
transform(code, path) {
|
||
if (path.substring(path.length - 4) == '.vue' && path.indexOf('/pages/') > -1) {
|
||
// :background-text-style="meta.theme"
|
||
let pft = '<page-meta :root-background-color="meta.bgcolor" :background-color="meta.bgcolor" :background-color-top="meta.bgcolor" :background-color-bottom="meta.bgcolor" :page-style="meta.style" :root-font-size="meta.fontsize" :page-font-size="meta.fontsize" :enable-pull-down-refresh="meta.pulldown"></page-meta>'; //'<page-meta :background-text-style="meta.theme" :root-background-color="meta.bgcolor" :background-color="meta.bgcolor" :background-color-top="meta.bgcolor" :background-color-bottom="meta.bgcolor" :page-style="meta.style" :root-font-size="meta.fontsize" :page-font-size="meta.fontsize" :enable-pull-down-refresh="meta.pulldown"></page-meta>';
|
||
pft += '<view :class="pageclass">';
|
||
pft += '<ciy-auth ref="auth"></ciy-auth>'; //暂时只做微信生态
|
||
pft += '<ciy-alert ref="alert"></ciy-alert>';
|
||
pft += '<ciy-toast ref="toast"></ciy-toast>';
|
||
//pft += '<ciy-dbg ref="dbg"></ciy-dbg>';
|
||
pft += '<ciy-popmenu ref="popmenu"></ciy-popmenu>';
|
||
|
||
let pfb = '</view>';
|
||
code = code.replace('<template>', '<template>' + pft);
|
||
let idx = code.lastIndexOf('</template>');
|
||
code = code.slice(0, idx) + pfb + code.slice(idx);
|
||
console.log('CiyPlugin:', path);
|
||
}
|
||
return code;
|
||
},
|
||
}
|
||
}
|
||
export default defineConfig({
|
||
plugins: [htmlPlugin_ciy(), uni()],
|
||
resolve: {
|
||
alias: {},
|
||
},
|
||
css: {
|
||
preprocessorOptions: {
|
||
// 设置scss全局变量
|
||
scss: {},
|
||
},
|
||
},
|
||
<<<<<<< HEAD
|
||
server: {},
|
||
=======
|
||
server: {
|
||
// 仅新增这一段代理配置,其他保持不变
|
||
port: 5173, // 保留你原本的5173端口
|
||
proxy: {
|
||
'/ambap': { // 转发/ambap开头的请求到Nginx
|
||
target: 'https://labsci.local.ciy.cn', // 你的Nginx域名
|
||
changeOrigin: true, // 允许跨域
|
||
secure: false // 忽略HTTPS证书校验(本地开发必加)
|
||
}
|
||
}
|
||
},
|
||
>>>>>>> 2b53f1cf47e1dea64c20044ab860c92bfd595c2a
|
||
}) |