Giter Club home page Giter Club logo

fivem-vuejs-boilerplate's Issues

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"

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>

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.