Authored by yyq

fix widget btn

1 <template> 1 <template>
2 <div class="icon-btn" @click="onClick" :style="btnStyle"> 2 <div class="icon-btn" @click="onClick" :style="btnStyle">
3 <i class="iconfont" :class="iconClass" :style="iconStyle"></i> 3 <i class="iconfont" :class="iconClass" :style="iconStyle"></i>
4 - <span v-if="text" class="icon-btn-text" :style="textStyle">{{text}}</span> 4 + <p v-if="text" class="icon-btn-text" :style="textStyle">
  5 + <span class="view-text">{{viewText}}</span>
  6 + <span class="placeholder-text">{{text}}</span>
  7 + </p>
5 </div> 8 </div>
6 </template> 9 </template>
7 10
@@ -56,7 +59,8 @@ @@ -56,7 +59,8 @@
56 data() { 59 data() {
57 return { 60 return {
58 btnSelected: false, 61 btnSelected: false,
59 - actionClass: '' 62 + actionClass: '',
  63 + editText: null
60 } 64 }
61 }, 65 },
62 computed: { 66 computed: {
@@ -101,6 +105,9 @@ @@ -101,6 +105,9 @@
101 } 105 }
102 106
103 return style; 107 return style;
  108 + },
  109 + viewText() {
  110 + return this.editText === null ? this.text : this.editText;
104 } 111 }
105 }, 112 },
106 methods: { 113 methods: {
@@ -108,8 +115,10 @@ @@ -108,8 +115,10 @@
108 if (this.option.canSelect) { 115 if (this.option.canSelect) {
109 this.btnSelected = !this.btnSelected; 116 this.btnSelected = !this.btnSelected;
110 117
111 - if (Number(this.text) !== NaN) {  
112 - this.text = Number(this.text) + (this.btnSelected ? 1 : -1); 118 + let _text = this.editText || this.text;
  119 +
  120 + if (Number(this.viewText) !== NaN) {
  121 + this.editText = Number(this.viewText) + (this.btnSelected ? 1 : -1);
113 } 122 }
114 123
115 if (this._icon.selected) { 124 if (this._icon.selected) {
@@ -136,6 +145,15 @@ @@ -136,6 +145,15 @@
136 145
137 .icon-btn-text { 146 .icon-btn-text {
138 line-height: 1.3; 147 line-height: 1.3;
  148 + position: relative;
  149 +
  150 + .view-text {
  151 + position: absolute;
  152 + }
  153 +
  154 + .placeholder-text {
  155 + opacity: 0;
  156 + }
139 } 157 }
140 } 158 }
141 </style> 159 </style>
@@ -39,7 +39,7 @@ exports.devServer = (app, cb) => { @@ -39,7 +39,7 @@ exports.devServer = (app, cb) => {
39 }; 39 };
40 40
41 clientConfig.entry.app = ['./build/client-hot.js', clientConfig.entry.app]; 41 clientConfig.entry.app = ['./build/client-hot.js', clientConfig.entry.app];
42 - clientConfig.output.publicPath = 'http://172.16.12.62:6005/'; 42 + clientConfig.output.publicPath = 'http://m.yohobuy.com:6005/';
43 clientConfig.output.filename = '[name].js'; 43 clientConfig.output.filename = '[name].js';
44 clientConfig.plugins.push( 44 clientConfig.plugins.push(
45 new webpack.HotModuleReplacementPlugin(), 45 new webpack.HotModuleReplacementPlugin(),