There is a requirement to display special characters in the input, which are printed unchanged using Unicode;
Here is an example of the renminbi symbol:
¥HTML code ¥ ¥ vue<a-input prefix="¥" suffix="RMB" /> <a-input prefix="¥" suffix="RMB" />Copy the code
Page display effect:
This is not the desired result, is the compilation time transcoding, rendering to the page is intact output;
The unicode code is \u00a5
So I tried it
<a-input prefix="\u00a5" suffix="RMB" />
Copy the code
The result is still the same output, code egg &^% %^%%^&*** *
On second thought, try defining a variable in JS.
data () {
return {
yen: '\u00a5'
}
},
<a-input :prefix="yen" suffix="RMB" />
Copy the code
A -input-numbe (a-input-numbe)
<a-input-number :min="0" :max="100" :formatter="value => `${yen}` +`${value}`.replace(/\B(? =(\d{3})+(? ! \d))/g, ',')" />Copy the code
Record the solution here, in case I’m a novice and forget it again.