提交 8314e195 编写于 作者: S suzigang

fix(searchbar): textalign types

上级 bca3f559
...@@ -116,10 +116,10 @@ ...@@ -116,10 +116,10 @@
"transliteration": "^2.2.0", "transliteration": "^2.2.0",
"ts-jest": "^26.5.5", "ts-jest": "^26.5.5",
"typescript": "4.6.4", "typescript": "4.6.4",
"vite": "^2.9.12", "vite": "2.9.0",
"vite-plugin-dts": "^1.0.5", "vite-plugin-dts": "^1.0.5",
"vite-plugin-md": "^0.11.8", "vite-plugin-md": "^0.11.8",
"vue": "3.2.24", "vue": "^3.2.24",
"vue-jest": "^5.0.0-alpha.7" "vue-jest": "^5.0.0-alpha.7"
}, },
"eslintConfig": { "eslintConfig": {
......
...@@ -24,15 +24,10 @@ ...@@ -24,15 +24,10 @@
@focus="valueFocus" @focus="valueFocus"
@blur="valueBlur" @blur="valueBlur"
@confirm="handleSubmit" @confirm="handleSubmit"
:style="(styleSearchbar as CSSProperties)" :style="styleSearchbar"
/> />
</form> </form>
<view <view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
@click="handleClear"
class="nut-searchbar__input-clear"
v-if="clearable"
v-show="(modelValue as string).length > 0"
>
<nut-icon :name="clearIcon" size="12" color="#555"></nut-icon> <nut-icon :name="clearIcon" size="12" color="#555"></nut-icon>
</view> </view>
</view> </view>
...@@ -50,10 +45,6 @@ ...@@ -50,10 +45,6 @@
import { toRefs, reactive, computed, ref, onMounted, PropType, Ref, CSSProperties } from 'vue'; import { toRefs, reactive, computed, ref, onMounted, PropType, Ref, CSSProperties } from 'vue';
import { createComponent } from '@/packages/utils/create'; import { createComponent } from '@/packages/utils/create';
const { create, translate } = createComponent('searchbar'); const { create, translate } = createComponent('searchbar');
// interface Events {
// eventName: 'change' | 'focus' | 'blur' | 'clear' | 'update:modelValue';
// params: (string | number | Event)[];
// }
export type confirmTextType = 'send' | 'search' | 'next' | 'go' | 'done'; export type confirmTextType = 'send' | 'search' | 'next' | 'go' | 'done';
export default create({ export default create({
...@@ -202,12 +193,12 @@ export default create({ ...@@ -202,12 +193,12 @@ export default create({
}; };
const styleSearchbar = computed(() => { const styleSearchbar = computed(() => {
return { const style: CSSProperties = {
style: { textAlign: props.inputAlign as import('./type').TextAlign
textAlign: props.inputAlign
}
}; };
return style;
}); });
const inputsearch: Ref<HTMLElement | null> = ref(null); const inputsearch: Ref<HTMLElement | null> = ref(null);
onMounted(() => { onMounted(() => {
if (props.autofocus) { if (props.autofocus) {
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
<script lang="ts"> <script lang="ts">
import { toRefs, reactive, computed, onMounted, ref, Ref, CSSProperties } from 'vue'; import { toRefs, reactive, computed, onMounted, ref, Ref, CSSProperties } from 'vue';
import { createComponent } from '@/packages/utils/create'; import { createComponent } from '@/packages/utils/create';
import { TextAlignProperty } from 'csstype';
const { create, translate } = createComponent('searchbar'); const { create, translate } = createComponent('searchbar');
// interface Events { // interface Events {
// eventName: 'change' | 'focus' | 'blur' | 'clear' | 'update:modelValue'; // eventName: 'change' | 'focus' | 'blur' | 'clear' | 'update:modelValue';
...@@ -209,7 +208,7 @@ export default create({ ...@@ -209,7 +208,7 @@ export default create({
const styleSearchbar = computed(() => { const styleSearchbar = computed(() => {
const style: CSSProperties = { const style: CSSProperties = {
textAlign: props.inputAlign as TextAlignProperty textAlign: props.inputAlign as import('./type').TextAlign
}; };
return style; return style;
}); });
......
export type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册