https://github.com/jhta/vue-trustpilot
Plugin to create Trustpilot widgets in an easy way.
https://github.com/jhta/vue-trustpilot
plugin trustpilot vue widget
Last synced: about 1 month ago
JSON representation
Plugin to create Trustpilot widgets in an easy way.
- Host: GitHub
- URL: https://github.com/jhta/vue-trustpilot
- Owner: jhta
- Created: 2019-08-27T07:29:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-10T13:42:33.000Z (over 3 years ago)
- Last Synced: 2025-04-15T16:14:49.575Z (about 2 months ago)
- Topics: plugin, trustpilot, vue, widget
- Language: JavaScript
- Size: 12.7 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vue-trustpilot
Plugin to create Trustpilot widgets in an easy way.
## Install
```bash
npm install vue-trustpilot --save
```## How to use it:
Add the static trustpilot script
```html
```
```js
import TrustpilotPlugin from "vue-trustpilot";const carouselWidget = {
templateId: "XXXX",
businessunitId: "XXXXX",
reviewUrl: "trustpilot.review.com/mywebsite.com",
locale: "en-us"
// ...more Trstupilot options in camel case
};const reviewsListWidget = {
templateId: "XXXX",
businessunitId: "XXXXX",
reviewUrl: "trustpilot.review.com/mywebsite.com",
locale: "en-us"
// ...more Trstupilot options in camel case
};const options = {
widgets: {
carousel: carouselWidget,
list: reviewsListWidget
}
};Vue.use(TrustpilotPlugin, options);
```The Plugin going to register the component `vue-trustpilot` globally.
In your Vue component:
```vue
```
Also, you can add more custom trustpilot arguments directly:
```vue
```
The result:

Additionally you can access to your widgets data using the method `$trustpilot` in Vue global scope
```vue
export default {
methods: {
printWidgetData() {
console.log(this.$trustpilot('carousel'))
}
}
}```
## Nuxt
```js
// trustpilot.js
const config = {
widgets: {
carousel: carouselWidget,
list: reviewsListWidget
}
};module.exports = config;
``````js
// nuxt.config.jsconst trustpilot = require("./trustpilot");
const config = {
modules: [["vue-trustpilot/nuxt", trustpilot]]
};
```NOTE: For Nuxt module is not needed to add the truspilot script