Giter Club home page Giter Club logo

fivem-vuejs-boilerplate's Introduction

FiveM VueJS Boilerplate

FiveM VueJS Boilerplate for building beautiful NUI-s without hassle of setting everything up

GitHub package.json version (subfolder of monorepo) GitHub GitHub last commit Maintenance

GitHub Repo stars GitHub forks


FiveM VueJS Boilerplate is a template for making your own NUI-s for FiveM using VueJS. It removes the hassle of setting everything up on your own and constantly dealing with errors and mistakes before you finally get it up and running. VueJS allows you to build out your NUI-s faster and it eases the logic implementation. With this boilerplate all you have to do is let your mind go wild and free on a creative spree and start making your own interface designs.


Key features

  • Pinia state management pre-implemented with examples of usage
  • Vuetify 3 pre-implemented with examples of usage
  • Axios pre-implemented with examples of usage
  • Client code pre-implemented with examples of usage
  • Watch script pre-implemented for building out the site for ui_view in-game

Installation

Download the zip files or clone the repository:

git clone https://github.com/alenvalek/fivem-vuejs-boilerplate.git

Open the project in a terminal of your choice and change the working directory into the html folder:

cd ./html

Install the required node packages

npm install

After that you can modify the api file inside html/api/axios.js in case you're planning to rename the resource.
After that you are ready to start building out your dream NUI.

Development tips

Run the following command to develop using a live server ( in browser )

npm run dev

Run the following command to build out your project for use in game

npm run build

Run the following command to build out the project for use in game every time a change has occured ( keep in mind you still have to restart the resource on your server for the changes to take effect ) [RECOMMENDED]

npm run watch

Technologies

Contributing

If you want to contribute to a project and make it better, every help is welcome.

How to contribute

  1. Fork the repo to your own personal GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work to your own branch
  5. Submit a pull request so changes can be reviewed before the merge

NOTE: Be sure to merge the latest from "upstream" before making a merge request.

License and license summary

FiveM BoilerPlate is licensed under MIT License

MIT License

Copyright (c) 2023 Alen Valek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

fivem-vuejs-boilerplate's People

Contributors

alenvalek avatar bertrammohr avatar

Stargazers

Rafał Chomczyk avatar Madsen avatar  avatar Nazri avatar Eric Inácio avatar  avatar Casper Thamdrup avatar Jam avatar Nuno Garcia avatar Hifzi avatar Kira. avatar Pey avatar  avatar Rashid avatar  avatar ST4LTH avatar Josh Yolles avatar  avatar Mário Ribeiro avatar Adam avatar  avatar everyonedontknowme avatar Jellyton avatar Paul avatar ZeroDouble9 avatar Jesper avatar  avatar Deniz Sarısülük avatar Eddie/Eddy avatar  avatar iLLeniumStudios avatar

Watchers

 avatar  avatar  avatar

fivem-vuejs-boilerplate's Issues

Passing Data to Vue

I am trying to pass a table to my VUE app and for whatever reason, the table is showing as null in the vue app

Not sure if i am just doing something dump... but if you could look at it and advise i would be greatful

Client.lua function

function SendPlayerDataToApp()
   local playerID = PlayerPedId()
   -- print(playerID)
   local PlayerID = GetPlayerServerId(NetworkGetPlayerIndexFromPed(playerID))
   -- print(PlayerID)
   ESX.TriggerServerCallback('ejcscomp:getPlayerData', function(playerData)
      job = ESX.GetPlayerData().job.name
      grade = ESX.GetPlayerData().job.grade
      playerData.job.name = job
      playerData.job.grade = grade
      -- print(playerData.name)
      -- print(job)
      print(label)
      SendNUIMessage({
         type = 'setPlayerData',
         data = playerData
      })
   end,PlayerID)
   

Server.lua function

ESX.RegisterServerCallback('ejcscomp:getPlayerData', function(source, cb, PlayerID)
        print(PlayerID)
        local playerData = {}
        local xPlayer = ESX.GetPlayerFromId(PlayerID)
        -- print(xPlayer)
        playerData.id = PlayerID
        playerData.name = xPlayer.name
        playerData.job = {}
        cb(playerData)
    end)

Store

export default new Vuex.Store({
	state: {
		playerData: {},
	},
	getters: {
		playerData(state) {
			return state.playerData;
		},
	},
	mutations: {
		setplayerData(state, payload) {
			print("Player Data:")
			print(payload.data)
			state.playerData = payload.data;
		},
	},
	actions: {},
});

mapGetters

computed: {
		...mapGetters(["playerData"]),
	},

display

<div v-if="playerData">
					<div>PlayerID: {{ playerData.id}}</div>
					<div>PlayerName: {{ playerData.name}}</div>
					<div>Job: {{ playerData.job.name}}</div>
					<div>Rank: {{ playerData.job.rank}}</div>
				</div>

Error running Build

I get an error when trying to run the "npm run build" command.

It throws this error: "Error: Debug Failure. False expression: Paths must either both be absolute or both be relative"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.