New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vike-vue

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vike-vue

<!-- WARNING: keep links absolute in this file so they work on NPM too -->

  • 0.7.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
decreased by-35.66%
Maintainers
3
Weekly downloads
 
Created
Source

npm version

vike-vue

Vue integration for Vike, see vike.dev/vue.

Introduction

UI framework Vike extensions like vike-vue:

  • implement Vike Core hooks (e.g. onRenderHtml()) on your behalf,
  • set Vike Core settings on your behalf,
  • introduce new hooks for you to implement if needed,
  • introduce new settings for you to set if needed,
  • introduce new components and component hooks.

Scaffold new app

Use Bati to scaffold a Vike app using vike-vue.

Add to existing app

To add vike-vue to an existing Vike app:

  1. Install the vike-vue npm package in your project:
npm install vike-vue
  1. Extend your existing Vike config files with vike-vue:
 // /pages/+config.js

+import vikeVue from 'vike-vue/config'
+
 export default {
   // Existing Vike Core settings
   // ...
+
+  // New setting introduced by vike-vue:
+  title: 'My Vike + Vue App',
+
+  extends: vikeVue
 }

Hooks

vike-vue implements the onRenderHtml() and onRenderClient() hooks on your behalf, which are essentially the glue code between Vike and Vue. All hooks are cumulative, so you can add your own hooks without overriding the default ones.

vike-vue introduces the following new hooks:

  • onCreateApp(): Allows you to extend the Vue app, typically for registering a Vue plugin.
  • onAfterRenderHtml(): Called right after rendering the app on the server. Usually used for dehydration of state management libraries.
  • onBeforeRenderClient(): Called before mounting the app on the client. Usually used for hydration of state management libraries.
  • bodyHtmlStart(): Called on the server and client. Allows you to add content at the start of the <body> tag.
  • bodyHtmlEnd(): Called on the server and client. Defaults to <div id="teleported"></div>. Allows you to add content at the end of the <body> tag.

Settings

vike-vue sets the following Vike Core settings on your behalf:

vike-vue introduces the following new settings:

  • Head: Component Component to be rendered inside the <head> tag.
  • title: string <title>...</title> tag.
  • favicon: string <link rel="icon" href="..." /> attribute.
  • lang: string <html lang="..."> attribute.
  • ssr: boolean Enable/disable Server-Side Rendering (SSR).
  • stream: boolean Enable/disable HTML streaming.
  • Layout: Component Wrapper for your Page component.

Component hooks

vike-vue introduces the following new component hooks:

Helpers

vike-vue introduces the following new helpers:

  • clientOnly(): load and render a component only on the client-side.

Teleports

Teleports work out of the box with vike-vue when using <Teleport to="teleported"> as we inject an empty div with id="teleported" by default. You can add more targets by using a custom bodyHtmlEnd() hook.

FAQs

Package last updated on 17 Jun 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc