InputMask 提示字符

默认情况下,InputMask控件使用下划线字符来指示预期输入的位置.

您可以通过向 proptChar 属性分配一个新字符串来更改此值:

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as input from '@grapecity/wijmo.input'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let theSSN = new input.InputMask('#theSSN', { mask: '000-00-0000', promptChar: '*' }); // let theZip = new input.InputMask('#theZip', { mask: '00000', promptChar: '^' }); // let theZip4 = new input.InputMask('#theZip4', { mask: '00000-0000', promptChar: '#' }); // let thePhone = new input.InputMask('#thePhone', { mask: '(999) 000-0000', promptChar: ' ' }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputMask promptChar</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div class="form-group"> <label for="theSSN">Social Security Number</label> <input id="theSSN"> </div> <div class="form-group"> <label for="theZip">Zip Code</label> <input id="theZip"> </div> <div class="form-group"> <label for="theZip4">Zip Code + 4</label> <input id="theZip4"> </div> <div class="form-group"> <label for="thePhone">Phone Number</label> <input id="thePhone"> </div> </div> </body> </html> body { margin-bottom: 24px; } label { width: 180px; text-align: right; margin-right: 3px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjInputModule } from '@grapecity/wijmo.angular2.input'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { } // @NgModule({ imports: [WjInputModule, BrowserModule], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputMask promptChar</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <div class="form-group"> <label for="theSSN">Social Security Number</label> <wj-input-mask id="theSSN" [mask]="'000-00-0000'" [promptChar]="'*'"></wj-input-mask> </div> <div class="form-group"> <label for="theZip">Zip Code</label> <wj-input-mask id="theZip" [mask]="'00000'" [promptChar]="'^'"></wj-input-mask> </div> <div class="form-group"> <label for="theZip4">Zip Code + 4</label> <wj-input-mask id="theZip4" [mask]="'00000-0000'" [promptChar]="'#'"></wj-input-mask> </div> <div class="form-group"> <label for="thePhone">Phone Number</label> <wj-input-mask id="thePhone" [mask]="'(999) 000-0000'" [promptChar]="' '"></wj-input-mask> </div> </div> body { margin-bottom: 24px; } label { width: 180px; text-align: right; margin-right: 3px; } <template> <div class="container-fluid"> <div class="form-group"> <label for="theSSN">Social Security Number</label> <wj-input-mask id="theSSN" :mask="'000-00-0000'" :promptChar="'*'"></wj-input-mask> </div> <div class="form-group"> <label for="theZip">Zip Code</label> <wj-input-mask id="theZip" :mask="'00000'" :promptChar="'^'"></wj-input-mask> </div> <div class="form-group"> <label for="theZip4">Zip Code + 4</label> <wj-input-mask id="theZip4" :mask="'00000-0000'" :promptChar="'#'"></wj-input-mask> </div> <div class="form-group"> <label for="thePhone">Phone Number</label> <wj-input-mask id="thePhone" :mask="'(999) 000-0000'" :promptChar="' '"></wj-input-mask> </div> </div> </template> <script> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.core'; import '@grapecity/wijmo.vue2.input'; let App = Vue.extend({ name: 'app' }) let vm = new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> body { margin-bottom: 24px; } label { width: 180px; text-align: right; margin-right: 3px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputMask promptChar</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjInput from '@grapecity/wijmo.react.input'; // class App extends React.Component { constructor(props) { super(props); } ; render() { return <div className="container-fluid"> <div className="form-group"> <label htmlFor="theSSN">Social Security Number </label> <wjInput.InputMask id="theSSN" mask="000-00-0000" promptChar="*"> </wjInput.InputMask> </div> <div className="form-group"> <label htmlFor="theZip">Zip Code </label> <wjInput.InputMask id="theZip" mask="00000" promptChar="^"> </wjInput.InputMask> </div> <div className=" form-group"> <label htmlFor="theZip4">Zip+4 Code </label> <wjInput.InputMask id="theZip4" mask="00000-0000" promptChar="#"> </wjInput.InputMask> </div> <div className="form-group"> <label htmlFor="thePhone">Phone Number </label> <wjInput.InputMask id="thePhone" mask="(999) 000-0000" promptChar=" "> </wjInput.InputMask> </div> </div>; } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> body { margin-bottom: 24px; } label { width: 180px; text-align: right; margin-right: 3px; }