mix phx.new counter --no-ecto
cd into the project
#start server 
mix phx.server

https://www.youtube.com/watch?v=U_Pe8Ru06fM
#Use github LiveView installation guide
https://github.com/phoenixframework/phoenix_live_view/blob/master/guides/introduction/installation.md

atom . minimises content size in your code editor
Add routing route

lib>views>router.ex
live "/counter", CounterLive

#Create CounterLive module
#Create new directory under counter_web (call it live)
#Create new file under live dir called counter_live.ex

defmodule CounterWeb.CounterLive do
  use Phoenix.LiveView


	def mount(_session,socket) do
     	socket = assign(socket, :count, 0)
		{:ok, socket} //this is the return value
    end
    
    def render(assigns) do
      ~L """
			<h1>Count: <%= @count  %></h1>
			<button phx-click="increament" >+</button>
			<button phx-click="decreament">-</button>
		"""
     end
     
     def handle_event("increament",_, socket) do
       count = socket.assigns.count + 1
	   socket = assign (socket, :count, count)
		{:nonreply, socket}
     end
     
     def handle_event("decreament",_, socket) do
       count = socket.assigns.count - 1
	   socket = assign (socket, :count, count)
		{:nonreply, socket}
     end     
      
end


mix phx.new my-app --live
mix deps.get

Elixir相关代码片段

elixir cheat sheet

elixir clear terminal

elixir int to string

elixir bcrypt

elixir string to character list

elixir variable in string

How do I turn off the console cursor in elixir

elixir add two string

elixir access list by index

binary to number elixir

elixir get last x characters of string

how to make unique column in elixir

elixir trapping exits

import module elixir

elixir get all ets

what is means term in elixir lang?

elixir list has value

elixir inspect unlimited

how to run elixir script in cmd

instance var elixir

naiveDateTime last week from current time elixir

list sigil elixir

elixir true

elixir print array

stringify atom elixir

Phoenix LiveView

elixir for loop

filter elixir enum example

elixir combine two string

elixir list length

elixir pid list

how to floor a value elixir

elixir string to integer

httpoison elixir

elixir map to list

elixir struct example

cast to int elixir

removing empty string from list in elixir

get length of map elixir

ternary elixir

elixir case statement

elixir string lowercase

map merge elixir

elixir how to io.inspect data

elixir read tuples

one line named elixir function

schema default value for field elixir

mix install phoenix

phoenix query get first record

phoenix system get env

hello world in elixir

elixir map

elixir hello world

elixir guard

elixir error

elixir with

elixir list

elixir strings

phoenix ecto preload

elixir get_in

elixir defguard

elixir rescue

how to split a string in elixir

elixir convert integer to float

elixir ternary operator

phoenix run test

phoenix enum filter

create new project phoenix

elixir sleep

elixir ecto pluck ids

defining constants in elixir module

elixir string regex

elixir string concatenation

elixir string concatination

phoenix run server

elixir datetime to timestamp

elixir map to new map

elixir mapset member

elixir function guards

elixir function pattern matching