Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@umajs/plugin-vue3-ssr
Advanced tools
In umajs, Vue3.0 is used to develop the plugin of SPA and MPA, which supports server-side rendering and client-side rendering
针对UMajs提供vue3.0服务端渲染模式的插件,插件基于服务端渲染骨架工具@Srejs/vue3开发。
plugin-vue3-ssr
插件扩展了UMajs
中提供的统一返回处理Result
对象,新增了vue
页面组件渲染方法,可在controller
自由调用,使用类似传统模板引擎;也同时将方法挂载到了koa中间件中的ctx
对象上;当一些公关的页面组件,比如404、异常提示页面、登录或者需要在中间件中拦截跳转时可以在middleware
中调用。
yarn add @umajs/plugin-vue3-ssr --save
// plugin.config.ts
export default <{ [key: string]: TPluginConfig }>{
'vue3-ssr': {
enable:true,
options:{
rootDir:'web', // 客户端页面组件根文件夹
rootNode:'app', // 客户端页面挂载根元素ID
ssr: true, // 全局开启服务端渲染
cache: false, // 全局使用服务端渲染缓存 开发环境设置true无效
prefixCDN: '/' // 客户端代码部署CDN前缀
}
}
};
框架默认配置属性rootDir
默认为根目录下web
,pages下是页面组件入口,比如list
页面,vue主入口文件为list/index.js
,页面组件为list/App.vue
└── web
└── pages
└── list
├── App.vue
├── index.js
<template>
<h1>{{title}}</h1>
<p>{{msg}}</p>
</template>
<script>
export default {
props:['title']
name: 'app',
setup(){
return {
msg:'hi vue3.0',
}
}
},
}
</script>
import App from './App.vue';
export default {
App, // 必须导出App
Router, //如使用vue-router 导出路由配置对象
Store, //如使用vuex 导出store对象
};
Pages
下按照文件夹名称定义vue页面组件,每一个页面组件必须包含inde.js
主入口文件,文件必须导出组件App
。如果使用vue-router
,则将路由配置导出为Router
对象;当使用vuex
时,则将初始化配置导出为Store
。
import { BaseController, Path } from '@umajs/core';
import { Result } from '../plugins/vue-ssr';
export default class Index extends BaseController {
@Path('/')
index() {
return Result.vue('index', { title: 'umajs-vue-ssr'});
}
}
FAQs
In umajs, Vue3.0 is used to develop the plugin of SPA and MPA, which supports server-side rendering and client-side rendering
The npm package @umajs/plugin-vue3-ssr receives a total of 0 weekly downloads. As such, @umajs/plugin-vue3-ssr popularity was classified as not popular.
We found that @umajs/plugin-vue3-ssr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.